Skip to content

Commit

Permalink
fix: added the token auth
Browse files Browse the repository at this point in the history
  • Loading branch information
aswathy-deriv committed Feb 21, 2024
1 parent 7e830cc commit 352c8be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/features/pages/signup-academy-complete/academy-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const StyledRelativeWrapper = styled(RelativeWrapper)`
export const ErrorMessage = styled.div<{ is_warning?: boolean }>`
position: absolute;
font-size: 12px;
color: ${({ is_warning }) => (is_warning ? 'var(--color-green)' : 'var(--color-red)')};
color: ${({ is_warning }) => (is_warning ? 'var(--color-yellow-3)' : 'var(--color-red)')};
padding: 6px 0;
`
const StyledIcon = styled.img<{ password_icon?: boolean }>`
Expand All @@ -48,6 +48,7 @@ export const Label = styled(StyledLabel)`
export const StyledInputWrapper = styled(InputWrapper)<{
password_length?: number
is_password?: boolean
// is_warning:boolean
}>`
border-radius: 4px;
border: solid 1px var(--color-grey-7);
Expand Down Expand Up @@ -98,7 +99,7 @@ const AcademyPasswordInput = ({
return (
<StyledRelativeWrapper>
<StyledInputWrapper
error={get_error_message()}
error={error_or_warning.is_warning ? '' : get_error_message()}
is_password={props.type === 'password'}
password_length={props.type === 'password' && props.value.length}
>
Expand Down
8 changes: 2 additions & 6 deletions src/features/pages/signup-academy-complete/password-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ const AcademyPasswordForm = ({ residence }: AcademyPasswordFormProps) => {
const params = new URLSearchParams(isBrowser() && location.search)
const codeValue = params.get('code')

const handleNavigation = () => {
window.location.href =
'https://oauth.deriv.com/oauth2/session/thinkific/create?app_id=37228'
}

const GetDerivAcademy = () => {
apiManager
.augmentedSend('new_account_virtual', {
Expand All @@ -55,14 +50,15 @@ const AcademyPasswordForm = ({ residence }: AcademyPasswordFormProps) => {
verification_code: codeValue,
})
.then((response) => {
const auth_token = response.new_account_virtual.oauth_token
console.log(response)
if (response.error) {
setSubmitStatus('error')
setSubmitErrorMsg(response.error.message)
} else {
setSubmitStatus('success')
//setting the session token
handleNavigation()
window.location.href = `https://oauth.deriv.com/oauth2/session/thinkific/create?app_id=37228&token1=${auth_token}`
}
})
}
Expand Down

0 comments on commit 352c8be

Please sign in to comment.