From e24049b1fb5702e103dcb77af75490ec2d97187c Mon Sep 17 00:00:00 2001 From: globuzma Date: Mon, 3 Feb 2025 15:34:31 +0100 Subject: [PATCH] Fix: Remove localhost from API URL --- app/app/account/profile/decks/page.tsx | 8 ++++---- app/app/account/signin/page.tsx | 2 +- app/app/admin/bsets/page.tsx | 8 ++++---- app/app/deck/[:id]/page.tsx | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/app/account/profile/decks/page.tsx b/app/app/account/profile/decks/page.tsx index 92c877c..0a74cb7 100644 --- a/app/app/account/profile/decks/page.tsx +++ b/app/app/account/profile/decks/page.tsx @@ -73,7 +73,7 @@ export default function Signin() { router.push('/') } - fetch('http://localhost:3000/api/account/decks/', { + fetch('/api/account/decks/', { method: "GET", headers: {Authorization: 'Bearer ' + token}, }).then((res) => { @@ -84,7 +84,7 @@ export default function Signin() { } }) - fetch('http://localhost:8072/misc/bsets.json').then((res) => { + fetch('/api/json/misc/bsets.json').then((res) => { if(res.status == 200) { res.json().then((data) => { setBsets(data) @@ -107,7 +107,7 @@ export default function Signin() { } function deleteDeck(id:string){ - fetch('http://localhost:3000/api/account/decks/delete', { + fetch('/api/account/decks/delete', { method: "DELETE", headers: {Authorization: 'Bearer ' + token}, body: JSON.stringify({ id }) @@ -137,7 +137,7 @@ export default function Signin() { }); console.log(dataToSend) - fetch('http://localhost:3000/api/account/decks/create', { + fetch('/api/account/decks/create', { method: "POST", headers: {Authorization: 'Bearer ' + token}, body: JSON.stringify(dataToSend) diff --git a/app/app/account/signin/page.tsx b/app/app/account/signin/page.tsx index 1beb546..b4eba82 100644 --- a/app/app/account/signin/page.tsx +++ b/app/app/account/signin/page.tsx @@ -31,7 +31,7 @@ export default function Signin() { "password": passwordField.current!.value } console.log(usernameField.current!.value + " - " + passwordField.current!.value) - const response = await fetch("http://localhost:3000/api/auth/signin", + const response = await fetch("/api/auth/signin", { method: "post", body: JSON.stringify(data) diff --git a/app/app/admin/bsets/page.tsx b/app/app/admin/bsets/page.tsx index ce432f9..6644f48 100644 --- a/app/app/admin/bsets/page.tsx +++ b/app/app/admin/bsets/page.tsx @@ -44,7 +44,7 @@ export default function Home() { const token = getCookie('JWT') useEffect(() => { - fetch('http://localhost:3000/api/admin/sets', { + fetch('/api/admin/sets', { method: "GET", headers: {Authorization: 'Bearer ' + token} }).then((res) => { @@ -55,7 +55,7 @@ export default function Home() { }) } }) - fetch('http://localhost:3000/api/admin/bsets', { + fetch('/api/admin/bsets', { method: "GET", headers: {Authorization: 'Bearer ' + token} }).then((res) => { @@ -88,7 +88,7 @@ export default function Home() { BSetNameInput.current!.value = "" - fetch('http://localhost:3000/api/admin/bsets/create', { + fetch('/api/admin/bsets/create', { method: "POST", headers: {Authorization: 'Bearer ' + token}, body: JSON.stringify(data) @@ -104,7 +104,7 @@ export default function Home() { } function deleteBSet(id: string){ - fetch('http://localhost:3000/api/admin/bsets/delete', { + fetch('/api/admin/bsets/delete', { method: "DELETE", headers: {Authorization: 'Bearer ' + token}, body: JSON.stringify({ id }) diff --git a/app/app/deck/[:id]/page.tsx b/app/app/deck/[:id]/page.tsx index 500b575..d4f5ffa 100644 --- a/app/app/deck/[:id]/page.tsx +++ b/app/app/deck/[:id]/page.tsx @@ -20,7 +20,7 @@ export default function Page() { const [deck, setDeck] = useState() useEffect(() => { - fetch('http://localhost:3000/api/deck/'+deckId, { + fetch('/api/deck/'+deckId, { method: "GET", }).then((res) => { if(res.status == 200) {