view data fixes

This commit is contained in:
2026-01-24 12:44:57 +01:00
parent 046852703f
commit 6749fe326b
47 changed files with 94 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
import { describe, it, expect } from 'vitest';
import { AuthApiClient } from './AuthApiClient';
describe('AuthApiClient', () => {
it('should be defined', () => {
expect(AuthApiClient).toBeDefined();
});
});

View File

@@ -0,0 +1,45 @@
import { BaseApiClient } from '../base/BaseApiClient';
import { AuthSessionDTO } from '../../types/generated/AuthSessionDTO';
import { LoginParamsDTO } from '../../types/generated/LoginParamsDTO';
import { SignupParamsDTO } from '../../types/generated/SignupParamsDTO';
import { ForgotPasswordDTO } from '../../types/generated/ForgotPasswordDTO';
import { ResetPasswordDTO } from '../../types/generated/ResetPasswordDTO';
/**
* Auth API Client
*
* Handles all authentication-related API operations.
*/
export class AuthApiClient extends BaseApiClient {
/** Sign up with email */
signup(params: SignupParamsDTO): Promise<AuthSessionDTO> {
return this.post<AuthSessionDTO>('/auth/signup', params);
}
/** Login with email */
login(params: LoginParamsDTO): Promise<AuthSessionDTO> {
return this.post<AuthSessionDTO>('/auth/login', params);
}
/** Get current session */
getSession(): Promise<AuthSessionDTO | null> {
return this.request<AuthSessionDTO | null>('GET', '/auth/session', undefined, {
allowUnauthenticated: true,
});
}
/** Logout */
logout(): Promise<void> {
return this.post<void>('/auth/logout', {});
}
/** Forgot password - send reset link */
forgotPassword(params: ForgotPasswordDTO): Promise<{ message: string; magicLink?: string }> {
return this.post<{ message: string; magicLink?: string }>('/auth/forgot-password', params);
}
/** Reset password with token */
resetPassword(params: ResetPasswordDTO): Promise<{ message: string }> {
return this.post<{ message: string }>('/auth/reset-password', params);
}
}