You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Cryptid/cryptide_project/src/services/SessionService.tsx

29 lines
794 B

import {ADRESSE_DBSERVER} from "../AdressConfig"
class SessionService {
static async getSession() {
try {
const response = await fetch(ADRESSE_DBSERVER + '/session', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
credentials: 'include',
});
if (response.ok) {
const result = await response.json();
return result;
} else {
const errorResponse = await response.json();
throw new Error(errorResponse.error);
}
} catch (error) {
console.error(error);
throw error;
}
}
}
export default SessionService;