/
nsstnc
/
lab3
Обзор
Документация
Войти
/
nsstnc
/
lab3
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/api/auth.ts
24 строки
661 B
nsstnc
Добавил функции для работы с ручками api
21 ноя 2025, 18:04
21 ноя 2025, 18:04
bacadf3
Код
Авторство
О чём код?
import api from './client' export interface AuthRequest { login: string password: string } export interface AuthResponse { accessToken: string refreshToken: string } export interface CurrentUser { id: number login: string createdAt: string blockedAt?: string | null } export const login = (data: AuthRequest) => api.post<AuthResponse>('/api/auth/login', data) export const register = (data: AuthRequest) => api.post<AuthResponse>('/api/auth/register', data) export const getCurrentUser = () => api.get<CurrentUser>('/api/auth/get/current').then(res => res.data) export const deleteCurrentUser = () => api.delete('/api/auth/delete/current')