Refactor: Update docker-compose.yml to remove unnecessary build and environment configurations

This commit is contained in:
M1000fr 2024-12-13 18:16:43 +01:00
parent 76d05af0bb
commit 52fc2b5e07
2 changed files with 12 additions and 11 deletions

View File

@ -3,8 +3,3 @@ 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

View File

@ -1,18 +1,16 @@
"use client"; "use client";
import { axiosInstance } from "@/app/lib/axios"; import { axiosInstance } from "@/app/lib/axios";
import { useRef } from "react"; import { useState } from "react";
export const FetchApi = () => { export const FetchApi = () => {
const listRef = useRef<HTMLUListElement>(null); const [date, setDate] = useState<string | null>(null);
const handleFetch = async () => { const handleFetch = async () => {
const response = await axiosInstance.get<{ const response = await axiosInstance.get<{
message: string; message: string;
}>("/ping"); }>("/ping");
const li = document.createElement("li"); setDate(response.data.message);
li.textContent = response.data.message;
listRef.current?.appendChild(li);
}; };
return ( return (
@ -23,7 +21,15 @@ export const FetchApi = () => {
> >
Fetch API Fetch API
</button> </button>
<ul ref={listRef}></ul> <div className="mt-4">
{date ? (
<p className="text-white">Server time: {date}</p>
) : (
<p className="text-white">
Click the button to fetch the API
</p>
)}
</div>
</div> </div>
); );
}; };