Merge pull request #143 from edx/adeel/van_370_make_single_option_call

Removes option call from validation endpoint
This commit is contained in:
adeel khan
2021-02-19 20:02:12 +05:00
committed by GitHub
3 changed files with 8 additions and 13 deletions

View File

@@ -1,15 +1,14 @@
import { getConfig } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
import { getHttpClient } from '@edx/frontend-platform/auth';
import formurlencoded from 'form-urlencoded';
// eslint-disable-next-line import/prefer-default-export
export async function forgotPassword(email) {
const requestConfig = {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
isPublic: true,
};
const { data } = await getAuthenticatedHttpClient()
const { data } = await getHttpClient()
.post(
`${getConfig().LMS_BASE_URL}/account/password`,
formurlencoded({ email }),

View File

@@ -1,14 +1,13 @@
import { getConfig } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
import { getHttpClient } from '@edx/frontend-platform/auth';
import querystring from 'querystring';
export async function registerRequest(registrationInformation) {
const requestConfig = {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
isPublic: true,
};
const { data } = await getAuthenticatedHttpClient()
const { data } = await getHttpClient()
.post(
`${getConfig().LMS_BASE_URL}/user_api/v2/account/registration/`,
querystring.stringify(registrationInformation),
@@ -27,10 +26,9 @@ export async function registerRequest(registrationInformation) {
export async function getFieldsValidations(formPayload) {
const requestConfig = {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
isPublic: true,
};
const { data } = await getAuthenticatedHttpClient()
const { data } = await getHttpClient()
.post(
`${getConfig().LMS_BASE_URL}/api/user/v1/validation/registration`,
querystring.stringify(formPayload),

View File

@@ -1,15 +1,14 @@
import { getConfig } from '@edx/frontend-platform';
import { getHttpClient, getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
import { getHttpClient } from '@edx/frontend-platform/auth';
import formurlencoded from 'form-urlencoded';
// eslint-disable-next-line import/prefer-default-export
export async function validateToken(token) {
const requestConfig = {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
isPublic: true,
};
const { data } = await getAuthenticatedHttpClient()
const { data } = await getHttpClient()
.post(
`${getConfig().LMS_BASE_URL}/user_api/v1/account/password_reset/token/validate/`,
formurlencoded({ token }),
@@ -25,7 +24,6 @@ export async function validateToken(token) {
export async function resetPassword(payload, token, queryParams) {
const requestConfig = {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
isPublic: true,
};
const url = new URL(`${getConfig().LMS_BASE_URL}/password/reset/${token}/`);
@@ -33,7 +31,7 @@ export async function resetPassword(payload, token, queryParams) {
url.searchParams.append('is_account_recovery', true);
}
const { data } = await getAuthenticatedHttpClient()
const { data } = await getHttpClient()
.post(url.href, formurlencoded(payload), requestConfig)
.catch((e) => {
throw (e);