feat(frontend): API client CSRF support + auth and admin-users API modules
This commit is contained in:
21
packages/frontend/src/api/auth.ts
Normal file
21
packages/frontend/src/api/auth.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
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),
|
||||
};
|
||||
Reference in New Issue
Block a user