|
|
|
|
@ -1,5 +1,7 @@ |
|
|
|
|
import { getApiUrl } from 'features/AuthServiceApp/config/routes' |
|
|
|
|
|
|
|
|
|
import { getClientSettings } from 'features/AuthStore/helpers' |
|
|
|
|
|
|
|
|
|
const errorLexics = { |
|
|
|
|
1: 'error_invalid_email_or_password', |
|
|
|
|
2: 'error_missing_required_argument', |
|
|
|
|
@ -23,19 +25,39 @@ type SuccessResponse = { |
|
|
|
|
|
|
|
|
|
type RegisterProps = { |
|
|
|
|
email: string, |
|
|
|
|
lang?: string, |
|
|
|
|
password: string, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const registerCheck = async ({ |
|
|
|
|
email, |
|
|
|
|
lang, |
|
|
|
|
password, |
|
|
|
|
} : RegisterProps) => { |
|
|
|
|
const { |
|
|
|
|
client_id, |
|
|
|
|
redirect_uri, |
|
|
|
|
response_mode, |
|
|
|
|
response_type, |
|
|
|
|
scope, |
|
|
|
|
} = getClientSettings() |
|
|
|
|
|
|
|
|
|
const url = getApiUrl('/registration') |
|
|
|
|
|
|
|
|
|
const paramsUrl = { |
|
|
|
|
client_id: client_id || 'ott-web', |
|
|
|
|
lang: lang || 'en', |
|
|
|
|
redirect_uri: redirect_uri || 'http://instat.tv/redirect', |
|
|
|
|
response_mode: response_mode || 'query', |
|
|
|
|
response_type: response_type || 'id_token token', |
|
|
|
|
scope: scope || 'openid', |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const init: RequestInit = { |
|
|
|
|
body: new URLSearchParams({ |
|
|
|
|
email, |
|
|
|
|
password, |
|
|
|
|
...paramsUrl, |
|
|
|
|
}), |
|
|
|
|
method: 'POST', |
|
|
|
|
} |
|
|
|
|
|