auth
This commit is contained in:
@@ -3,6 +3,9 @@ import { SessionViewModel } from '../../view-models/SessionViewModel';
|
||||
import type { LoginParamsDTO } from '../../types/generated/LoginParamsDTO';
|
||||
import type { SignupParamsDTO } from '../../types/generated/SignupParamsDTO';
|
||||
import type { LoginWithIracingCallbackParamsDTO } from '../../types/generated/LoginWithIracingCallbackParamsDTO';
|
||||
import type { ForgotPasswordDTO } from '../../types/generated/ForgotPasswordDTO';
|
||||
import type { ResetPasswordDTO } from '../../types/generated/ResetPasswordDTO';
|
||||
import type { DemoLoginDTO } from '../../types/generated/DemoLoginDTO';
|
||||
|
||||
/**
|
||||
* Auth Service
|
||||
@@ -68,4 +71,38 @@ export class AuthService {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forgot password - send reset link
|
||||
*/
|
||||
async forgotPassword(params: ForgotPasswordDTO): Promise<{ message: string; magicLink?: string }> {
|
||||
try {
|
||||
return await this.apiClient.forgotPassword(params);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset password with token
|
||||
*/
|
||||
async resetPassword(params: ResetPasswordDTO): Promise<{ message: string }> {
|
||||
try {
|
||||
return await this.apiClient.resetPassword(params);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Demo login (development only)
|
||||
*/
|
||||
async demoLogin(params: DemoLoginDTO): Promise<SessionViewModel> {
|
||||
try {
|
||||
const dto = await this.apiClient.demoLogin(params);
|
||||
return new SessionViewModel(dto.user);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user