u
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { http, logApi } from './http.js';
|
||||
|
||||
export const auth = {
|
||||
// #region GET /api/auth/me — me
|
||||
async me() {
|
||||
try {
|
||||
const data = await http('/api/auth/me');
|
||||
@@ -20,7 +21,9 @@ export const auth = {
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
// #endregion
|
||||
|
||||
// #region POST /api/auth/login — loginWithGoogle
|
||||
async loginWithGoogle(idToken) {
|
||||
logApi('loginWithGoogle', {
|
||||
idTokenLength: idToken?.length ?? 0,
|
||||
@@ -41,7 +44,9 @@ export const auth = {
|
||||
});
|
||||
return { user: data.user, session };
|
||||
},
|
||||
// #endregion
|
||||
|
||||
// #region POST /api/auth/logout — logout
|
||||
async logout() {
|
||||
try {
|
||||
await http('/api/auth/logout', { method: 'POST' });
|
||||
@@ -49,4 +54,5 @@ export const auth = {
|
||||
if (err.status !== 401) throw err;
|
||||
}
|
||||
},
|
||||
// #endregion
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user