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.
27 lines
748 B
27 lines
748 B
class SessionService {
|
|
static async getSession() {
|
|
try {
|
|
const response = await fetch('http://172.20.10.4:3003/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;
|
|
|