31 lines
789 B
TypeScript
31 lines
789 B
TypeScript
|
import { Responses, Requests, post, post_token } from './base';
|
||
|
|
||
|
export const auth_login = (
|
||
|
username: string,
|
||
|
password: string,
|
||
|
otp?: string
|
||
|
): Promise<
|
||
|
| Responses.Auth.LoginResponse
|
||
|
| Responses.Auth.TfaRequiredResponse
|
||
|
| Responses.ErrorResponse
|
||
|
> =>
|
||
|
post<Requests.Auth.AuthLoginRequest>('/api/auth/login', {
|
||
|
username: username,
|
||
|
password: password,
|
||
|
otp: otp
|
||
|
});
|
||
|
|
||
|
export const auth_signup = (
|
||
|
username: string,
|
||
|
password: string
|
||
|
): Promise<Responses.Auth.SignupResponse | Responses.ErrorResponse> =>
|
||
|
post<Requests.Auth.AuthSignUpRequest>('/api/auth/signup', {
|
||
|
username: username,
|
||
|
password: password
|
||
|
});
|
||
|
|
||
|
export const refresh_token = (
|
||
|
token: string
|
||
|
): Promise<Responses.Auth.RefreshResponse | Responses.ErrorResponse> =>
|
||
|
post_token('/api/auth/refresh', '', token);
|