view models
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { BaseApiClient } from '../base/BaseApiClient';
|
||||
import type {
|
||||
LoginParamsDto,
|
||||
SignupParamsDto,
|
||||
SessionDataDto,
|
||||
} from '../../dtos';
|
||||
import { AuthSessionDTO } from '../../types/generated/AuthSessionDTO';
|
||||
|
||||
// TODO: Create DTOs for login/signup params in apps/website/lib/types/generated
|
||||
type LoginParamsDto = { email: string; password: string };
|
||||
type SignupParamsDto = { email: string; password: string; displayName: string };
|
||||
|
||||
/**
|
||||
* Auth API Client
|
||||
@@ -12,18 +12,18 @@ import type {
|
||||
*/
|
||||
export class AuthApiClient extends BaseApiClient {
|
||||
/** Sign up with email */
|
||||
signup(params: SignupParamsDto): Promise<SessionDataDto> {
|
||||
return this.post<SessionDataDto>('/auth/signup', params);
|
||||
signup(params: SignupParamsDto): Promise<AuthSessionDTO> {
|
||||
return this.post<AuthSessionDTO>('/auth/signup', params);
|
||||
}
|
||||
|
||||
/** Login with email */
|
||||
login(params: LoginParamsDto): Promise<SessionDataDto> {
|
||||
return this.post<SessionDataDto>('/auth/login', params);
|
||||
login(params: LoginParamsDto): Promise<AuthSessionDTO> {
|
||||
return this.post<AuthSessionDTO>('/auth/login', params);
|
||||
}
|
||||
|
||||
/** Get current session */
|
||||
getSession(): Promise<SessionDataDto | null> {
|
||||
return this.get<SessionDataDto | null>('/auth/session');
|
||||
getSession(): Promise<AuthSessionDTO | null> {
|
||||
return this.get<AuthSessionDTO | null>('/auth/session');
|
||||
}
|
||||
|
||||
/** Logout */
|
||||
|
||||
Reference in New Issue
Block a user