accounts-frontend/packages/app/services/api/signup.ts

38 lines
990 B
TypeScript
Raw Normal View History

import request, { Resp } from 'app/services/request';
2016-07-28 10:33:30 +05:30
2019-12-07 16:58:52 +05:30
import { OAuthResponse } from './authentication';
interface RegisterParams {
2020-05-24 04:38:24 +05:30
email?: string;
username?: string;
password?: string;
rePassword?: string;
rulesAgreement?: boolean;
lang?: string;
captcha?: string;
}
2016-07-28 10:33:30 +05:30
export function register({
2020-05-24 04:38:24 +05:30
email = '',
username = '',
password = '',
rePassword = '',
rulesAgreement = false,
lang = '',
captcha = '',
}: RegisterParams): Promise<Resp<{ success: boolean }>> {
2020-05-24 04:38:24 +05:30
return request.post(
'/api/signup',
{ email, username, password, rePassword, rulesAgreement, lang, captcha },
{ token: null },
);
}
2016-07-28 10:33:30 +05:30
export function activate(key: string = ''): Promise<Resp<OAuthResponse>> {
2020-05-24 04:38:24 +05:30
return request.post('/api/signup/confirm', { key }, { token: null });
}
export function resendActivation(email: string = '', captcha: string = '') {
2020-05-24 04:38:24 +05:30
return request.post('/api/signup/repeat-message', { email, captcha });
}