Fix: Remove localhost from API URL

This commit is contained in:
globuzma 2025-02-03 15:34:31 +01:00
parent 238b594b1e
commit e24049b1fb
4 changed files with 10 additions and 10 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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 })

View file

@ -20,7 +20,7 @@ export default function Page() {
const [deck, setDeck] = useState<deckFromApi>()
useEffect(() => {
fetch('http://localhost:3000/api/deck/'+deckId, {
fetch('/api/deck/'+deckId, {
method: "GET",
}).then((res) => {
if(res.status == 200) {