Compare commits
1 Commits
feature/au
...
main
Author | SHA1 | Date | |
---|---|---|---|
54330f2137 |
@ -3,3 +3,8 @@ services:
|
|||||||
image: toogether/webapp
|
image: toogether/webapp
|
||||||
ports:
|
ports:
|
||||||
- "80:3000"
|
- "80:3000"
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
- NEXT_PUBLIC_API_URL=http://api:3000
|
@ -1,16 +1,18 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { axiosInstance } from "@/app/lib/axios";
|
import { axiosInstance } from "@/app/lib/axios";
|
||||||
import { useState } from "react";
|
import { useRef } from "react";
|
||||||
|
|
||||||
export const FetchApi = () => {
|
export const FetchApi = () => {
|
||||||
const [date, setDate] = useState<string | null>(null);
|
const listRef = useRef<HTMLUListElement>(null);
|
||||||
|
|
||||||
const handleFetch = async () => {
|
const handleFetch = async () => {
|
||||||
const response = await axiosInstance.get<{
|
const response = await axiosInstance.get<{
|
||||||
message: string;
|
message: string;
|
||||||
}>("/ping");
|
}>("/ping");
|
||||||
|
|
||||||
setDate(response.data.message);
|
const li = document.createElement("li");
|
||||||
|
li.textContent = response.data.message;
|
||||||
|
listRef.current?.appendChild(li);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -21,11 +23,7 @@ export const FetchApi = () => {
|
|||||||
>
|
>
|
||||||
Fetch API
|
Fetch API
|
||||||
</button>
|
</button>
|
||||||
{date ? (
|
<ul ref={listRef}></ul>
|
||||||
<p>Server time: {date}</p>
|
|
||||||
) : (
|
|
||||||
<p>Click the button to fetch the API</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -2,8 +2,6 @@ import axios from "axios";
|
|||||||
import moment, { Moment } from "moment";
|
import moment, { Moment } from "moment";
|
||||||
import { getSession } from "next-auth/react";
|
import { getSession } from "next-auth/react";
|
||||||
|
|
||||||
moment.locale("fr");
|
|
||||||
|
|
||||||
let cachedAccessToken: string | null = null;
|
let cachedAccessToken: string | null = null;
|
||||||
let tokenExpirationAt: Moment | null = null;
|
let tokenExpirationAt: Moment | null = null;
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@ import moment from "moment";
|
|||||||
import { AuthOptions, Session } from "next-auth";
|
import { AuthOptions, Session } from "next-auth";
|
||||||
import { JWT } from "next-auth/jwt";
|
import { JWT } from "next-auth/jwt";
|
||||||
|
|
||||||
moment.locale("fr");
|
|
||||||
|
|
||||||
export const authOptions: AuthOptions = {
|
export const authOptions: AuthOptions = {
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user