Aggiustate cose
This commit is contained in:
+4
-4
@@ -4,7 +4,7 @@ let USER = false
|
||||
export async function getLoggedUser() {
|
||||
if (USER === false) {
|
||||
console.log('Caching user data...')
|
||||
USER = await (await fetch(`${import.meta.env.BASE_URL}/api/user`)).json()
|
||||
USER = await (await fetch(`${import.meta.env.BASE_URL}api/user`)).json()
|
||||
}
|
||||
|
||||
return USER
|
||||
@@ -17,7 +17,7 @@ export function createRoomEventStream(roomId) {
|
||||
export const Database = {
|
||||
async getSeats(roomId) {
|
||||
const seatList = await (
|
||||
await fetch(`${import.meta.env.BASE_URL}/api/room/seats?id=${roomId}`)
|
||||
await fetch(`${import.meta.env.BASE_URL}api/room/seats?id=${roomId}`)
|
||||
).json()
|
||||
const seats = {}
|
||||
|
||||
@@ -28,7 +28,7 @@ export const Database = {
|
||||
return seats
|
||||
},
|
||||
async occupySeat(seatId) {
|
||||
const response = await fetch(`${import.meta.env.BASE_URL}/api/seat/occupy?id=${seatId}`, {
|
||||
const response = await fetch(`${import.meta.env.BASE_URL}api/seat/occupy?id=${seatId}`, {
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
@@ -39,7 +39,7 @@ export const Database = {
|
||||
await response.json()
|
||||
},
|
||||
async leaveSeat(seatId) {
|
||||
const response = await fetch(`${import.meta.env.BASE_URL}/api/seat/leave?id=${seatId}`, {
|
||||
const response = await fetch(`${import.meta.env.BASE_URL}api/seat/leave?id=${seatId}`, {
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ const elLogoutButton = document.querySelector('#logout-button')
|
||||
const elRoomGrid = document.querySelector('.room-grid')
|
||||
|
||||
async function logout() {
|
||||
await fetch(`${import.meta.env.BASE_URL}/api/logout`, { method: 'POST' })
|
||||
await fetch(`${import.meta.env.BASE_URL}api/logout`, { method: 'POST' })
|
||||
location.href = '/'
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ function displayErrorString(e) {
|
||||
|
||||
async function login() {
|
||||
try {
|
||||
const response = await fetch(`${import.meta.env.BASE_URL}/api/login`, {
|
||||
const response = await fetch(`${import.meta.env.BASE_URL}api/login`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json, text/plain, */*',
|
||||
|
||||
Reference in New Issue
Block a user