2020-01-18 02:07:52 +05:30
|
|
|
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';
|
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
interface RegisterParams {
|
|
|
|
email?: string;
|
|
|
|
username?: string;
|
|
|
|
password?: string;
|
|
|
|
rePassword?: string;
|
|
|
|
rulesAgreement?: boolean;
|
|
|
|
lang?: string;
|
|
|
|
captcha?: string;
|
|
|
|
}
|
2016-07-28 10:33:30 +05:30
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
export function register({
|
|
|
|
email = '',
|
|
|
|
username = '',
|
|
|
|
password = '',
|
|
|
|
rePassword = '',
|
|
|
|
rulesAgreement = false,
|
|
|
|
lang = '',
|
|
|
|
captcha = '',
|
|
|
|
}: RegisterParams): Promise<Resp<void>> {
|
|
|
|
return request.post(
|
|
|
|
'/api/signup',
|
|
|
|
{ email, username, password, rePassword, rulesAgreement, lang, captcha },
|
|
|
|
{ token: null },
|
|
|
|
);
|
|
|
|
}
|
2016-07-28 10:33:30 +05:30
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
export function activate(key: string = ''): Promise<Resp<OAuthResponse>> {
|
|
|
|
return request.post('/api/signup/confirm', { key }, { token: null });
|
|
|
|
}
|
|
|
|
|
|
|
|
export function resendActivation(email: string = '', captcha: string = '') {
|
|
|
|
return request.post('/api/signup/repeat-message', { email, captcha });
|
|
|
|
}
|