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('/') router.push('/')
} }
fetch('http://localhost:3000/api/account/decks/', { fetch('/api/account/decks/', {
method: "GET", method: "GET",
headers: {Authorization: 'Bearer ' + token}, headers: {Authorization: 'Bearer ' + token},
}).then((res) => { }).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) { if(res.status == 200) {
res.json().then((data) => { res.json().then((data) => {
setBsets(data) setBsets(data)
@ -107,7 +107,7 @@ export default function Signin() {
} }
function deleteDeck(id:string){ function deleteDeck(id:string){
fetch('http://localhost:3000/api/account/decks/delete', { fetch('/api/account/decks/delete', {
method: "DELETE", method: "DELETE",
headers: {Authorization: 'Bearer ' + token}, headers: {Authorization: 'Bearer ' + token},
body: JSON.stringify({ id }) body: JSON.stringify({ id })
@ -137,7 +137,7 @@ export default function Signin() {
}); });
console.log(dataToSend) console.log(dataToSend)
fetch('http://localhost:3000/api/account/decks/create', { fetch('/api/account/decks/create', {
method: "POST", method: "POST",
headers: {Authorization: 'Bearer ' + token}, headers: {Authorization: 'Bearer ' + token},
body: JSON.stringify(dataToSend) body: JSON.stringify(dataToSend)

View file

@ -31,7 +31,7 @@ export default function Signin() {
"password": passwordField.current!.value "password": passwordField.current!.value
} }
console.log(usernameField.current!.value + " - " + 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", method: "post",
body: JSON.stringify(data) body: JSON.stringify(data)

View file

@ -44,7 +44,7 @@ export default function Home() {
const token = getCookie('JWT') const token = getCookie('JWT')
useEffect(() => { useEffect(() => {
fetch('http://localhost:3000/api/admin/sets', { fetch('/api/admin/sets', {
method: "GET", method: "GET",
headers: {Authorization: 'Bearer ' + token} headers: {Authorization: 'Bearer ' + token}
}).then((res) => { }).then((res) => {
@ -55,7 +55,7 @@ export default function Home() {
}) })
} }
}) })
fetch('http://localhost:3000/api/admin/bsets', { fetch('/api/admin/bsets', {
method: "GET", method: "GET",
headers: {Authorization: 'Bearer ' + token} headers: {Authorization: 'Bearer ' + token}
}).then((res) => { }).then((res) => {
@ -88,7 +88,7 @@ export default function Home() {
BSetNameInput.current!.value = "" BSetNameInput.current!.value = ""
fetch('http://localhost:3000/api/admin/bsets/create', { fetch('/api/admin/bsets/create', {
method: "POST", method: "POST",
headers: {Authorization: 'Bearer ' + token}, headers: {Authorization: 'Bearer ' + token},
body: JSON.stringify(data) body: JSON.stringify(data)
@ -104,7 +104,7 @@ export default function Home() {
} }
function deleteBSet(id: string){ function deleteBSet(id: string){
fetch('http://localhost:3000/api/admin/bsets/delete', { fetch('/api/admin/bsets/delete', {
method: "DELETE", method: "DELETE",
headers: {Authorization: 'Bearer ' + token}, headers: {Authorization: 'Bearer ' + token},
body: JSON.stringify({ id }) body: JSON.stringify({ id })

View file

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