17 lines
424 B
TypeScript
17 lines
424 B
TypeScript
import { api } from '$api';
|
|
|
|
export interface SessionInfo {
|
|
isAuthenticated: boolean;
|
|
}
|
|
|
|
export interface WhoAmI {
|
|
username: string;
|
|
}
|
|
|
|
export const authApi = {
|
|
session: () => api.get<SessionInfo>('/session/'),
|
|
whoami: () => api.get<WhoAmI>('/whoami/'),
|
|
login: (username: string, password: string) =>
|
|
api.post<{ detail?: string }>('/login/', { username, password }),
|
|
logout: () => api.post<void>('/logout/', {}),
|
|
};
|