/
LastBlast
/
social-network
Обзор
Документация
Войти
/
LastBlast
/
social-network
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/api/auth-api.ts
36 строк
739 B
Victoria Rozhkova
types api
31 авг 2022, 15:48
31 авг 2022, 15:48
70650cd
Код
Авторство
О чём код?
import { instanse, APIResponseType } from "./api"; type MeResponseDataType = { id: number; email: string; login: string; }; type LoginResponseDataType = { userId: number; }; export const AuthAPI = { me() { return instanse .get<APIResponseType<MeResponseDataType>>(`auth/me`) .then((res) => res.data); }, login( email: string, password: string, rememberMe = false, captcha: null | string = null ) { return instanse .post<APIResponseType<LoginResponseDataType>>(`auth/login`, { email, password, rememberMe, captcha, }) .then((res) => res.data); }, logout() { return instanse.delete(`auth/login`).then((res) => res.data); }, };