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 {
|
2020-05-24 04:38:24 +05:30
|
|
|
email?: string;
|
|
|
|
username?: string;
|
|
|
|
password?: string;
|
|
|
|
rePassword?: string;
|
|
|
|
rulesAgreement?: boolean;
|
|
|
|
lang?: string;
|
|
|
|
captcha?: string;
|
2020-01-18 02:07:52 +05:30
|
|
|
}
|
2016-07-28 10:33:30 +05:30
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
export function register({
|
2020-05-24 04:38:24 +05:30
|
|
|
email = '',
|
|
|
|
username = '',
|
|
|
|
password = '',
|
|
|
|
rePassword = '',
|
|
|
|
rulesAgreement = false,
|
|
|
|
lang = '',
|
|
|
|
captcha = '',
|
2021-03-28 20:37:46 +05:30
|
|
|
}: 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 },
|
|
|
|
);
|
2020-01-18 02:07:52 +05:30
|
|
|
}
|
2016-07-28 10:33:30 +05:30
|
|
|
|
2020-01-18 02:07:52 +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 });
|
2020-01-18 02:07:52 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
export function resendActivation(email: string = '', captcha: string = '') {
|
2020-05-24 04:38:24 +05:30
|
|
|
return request.post('/api/signup/repeat-message', { email, captcha });
|
2020-01-18 02:07:52 +05:30
|
|
|
}
|