This commit is contained in:
seb
2026-10-10 18:17:14 +02:00
parent 004e0de869
commit a20668cd61
31 changed files with 572 additions and 76 deletions

View File

@@ -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
};