22 lines
1.2 KiB
TypeScript
22 lines
1.2 KiB
TypeScript
import type {
|
|
PublicUser, User,
|
|
LoginInput, RegisterInput, VerifyEmailInput, ResendVerificationInput,
|
|
ForgotPasswordInput, ResetPasswordInput, AcceptInviteInput,
|
|
ProfileUpdateInput, ChangePasswordInput,
|
|
} from '@flashcard/shared';
|
|
import { api } from './client.js';
|
|
|
|
export const authApi = {
|
|
me: () => api.get<User>('/auth/me'),
|
|
register: (input: RegisterInput) => api.post<PublicUser>('/auth/register', input),
|
|
verifyEmail: (input: VerifyEmailInput) => api.post<{ ok: true }>('/auth/verify-email', input),
|
|
resendVerification: (input: ResendVerificationInput) => api.post<{ ok: true }>('/auth/resend-verification', input),
|
|
login: (input: LoginInput) => api.post<PublicUser>('/auth/login', input),
|
|
logout: () => api.post<void>('/auth/logout'),
|
|
forgotPassword: (input: ForgotPasswordInput) => api.post<{ ok: true }>('/auth/forgot-password', input),
|
|
resetPassword: (input: ResetPasswordInput) => api.post<{ ok: true }>('/auth/reset-password', input),
|
|
acceptInvite: (input: AcceptInviteInput) => api.post<PublicUser>('/auth/accept-invite', input),
|
|
updateProfile: (input: ProfileUpdateInput) => api.patch<PublicUser>('/auth/profile', input),
|
|
changePassword: (input: ChangePasswordInput) => api.post<void>('/auth/change-password', input),
|
|
};
|