This commit is contained in:
arrelin
2026-01-17 10:15:44 +03:00
parent 564adac629
commit a4b06fb057
26 changed files with 1542 additions and 346 deletions

View File

@@ -7,6 +7,8 @@ import type {
LoginRequest,
LoginResponse,
CreateFamilyRequest,
CreateMyFamilyRequest,
CreateMyFamilyResponse,
CreateCategoryRequest,
CreateExpenseRequest,
VerifyFamilyPasswordRequest,
@@ -16,6 +18,8 @@ import type {
UpdateShoppingItemRequest,
MarkAsPurchasedRequest,
BulkOperationResponse,
User,
OAuthUrlResponse,
} from '../types';
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || '';
@@ -31,6 +35,14 @@ export const authApi = {
logout: () =>
apiClient.post('/logout'),
me: () =>
apiClient.get<User>('/me'),
getGoogleAuthUrl: (redirectUrl?: string) =>
apiClient.get<OAuthUrlResponse>('/auth/google', {
params: redirectUrl ? { redirect_url: redirectUrl } : undefined,
}),
};
export const familyApi = {
@@ -43,6 +55,9 @@ export const familyApi = {
create: (data: CreateFamilyRequest) =>
apiClient.post<Family>('/families', data),
createMyFamily: (data: CreateMyFamilyRequest) =>
apiClient.post<CreateMyFamilyResponse>('/my-family', data),
update: (id: number, data: { name: string }) =>
apiClient.put<Family>(`/families/${id}`, data),