1234567891011121314151617181920212223242526272829303132 |
- import { useQuery } from '@tanstack/react-query';
- import { authApi, PostLoginUserReturn } from '../auth-api';
- import { BaseAxiosError } from '../../../../types';
- import { authQueryKeys } from '../auth-query-keys';
- export type UserRegistrationData = {
- user: {
- username: string;
- email: string;
- password: string;
- first_name: string;
- last_name: string;
- date_of_birth: Date;
- homebase: number;
- };
- photo: {
- type: string;
- uri: string;
- name: string;
- };
- };
- export const usePostRegister = (data: UserRegistrationData, enabled: boolean) => {
- return useQuery<PostLoginUserReturn, BaseAxiosError>({
- queryKey: authQueryKeys.registerUser(),
- queryFn: async () => {
- const response = await authApi.registerUser(data);
- return response.data;
- },
- enabled
- });
- };
|