/
lizardking
/
react_final
Обзор
Документация
Войти
/
lizardking
/
react_final
Код
Запросы
1
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
src/features/auth/api/authApi.ts
39 строк
1 KB
LizardKing
Рефакторинг на FSD
24 ноя 2025, 16:05
24 ноя 2025, 16:05
eedf5c5
Код
Авторство
О чём код?
import { createApi } from '@reduxjs/toolkit/query/react' import type { User } from 'entities/user' import { customBaseQuery } from 'shared/store/api/config' import type { SignUpFormValues } from 'widgets/SignUpForm/utils/types' import type { Token } from '../model/types' type SignUpResponse = { user: Pick<User, 'id' | 'email'> accessToken: Token['accessToken'] } type SignInResponse = { user: Pick<User, 'id' | 'email'> accessToken: Token['accessToken'] } export const authApi = createApi({ reducerPath: 'authApi', baseQuery: customBaseQuery, endpoints: (builder) => ({ signUp: builder.mutation<SignUpResponse, SignUpFormValues>({ query: (signUpFormValues) => ({ url: '/auth/register', method: 'POST', body: signUpFormValues, }), }), signIn: builder.mutation<SignInResponse, SignUpFormValues>({ query: (signInFormValues) => ({ url: '/auth/login', method: 'POST', body: signInFormValues, }), }), }), }) export const { useSignInMutation, useSignUpMutation } = authApi