38 lines
774 B
JavaScript
38 lines
774 B
JavaScript
|
|
import { apiFetch } from './client.js'
|
||
|
|
|
||
|
|
export function fetchMe() {
|
||
|
|
return apiFetch('/api/me')
|
||
|
|
}
|
||
|
|
|
||
|
|
export function fetchContext() {
|
||
|
|
return apiFetch('/api/me/context')
|
||
|
|
}
|
||
|
|
|
||
|
|
export function fetchEntitlements() {
|
||
|
|
return apiFetch('/api/me/entitlements')
|
||
|
|
}
|
||
|
|
|
||
|
|
export function login(email, password) {
|
||
|
|
return apiFetch('/api/auth/login', {
|
||
|
|
method: 'POST',
|
||
|
|
body: JSON.stringify({ email, password }),
|
||
|
|
token: null,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
export function register(payload) {
|
||
|
|
return apiFetch('/api/auth/register', {
|
||
|
|
method: 'POST',
|
||
|
|
body: JSON.stringify(payload),
|
||
|
|
token: null,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
export function logout() {
|
||
|
|
return apiFetch('/api/auth/logout', { method: 'POST' })
|
||
|
|
}
|
||
|
|
|
||
|
|
export function fetchSetupStatus() {
|
||
|
|
return apiFetch('/api/auth/setup-status', { token: null })
|
||
|
|
}
|