Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #241 from hubert-deriv/cannot_set_markup_demo
Browse files Browse the repository at this point in the history
  • Loading branch information
hubert-deriv authored Aug 24, 2023
2 parents 9a0f6ec + c468033 commit 54c3e88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ApplicationObject } from '@deriv/api-types';
import { RegisterAppDialogError } from '../RegisterAppDialogError';
import { scopesArrayToObject, scopesObjectToArray } from '@site/src/utils';
import styles from './update-app-dialog.module.scss';
import useAuthContext from '@site/src/hooks/useAuthContext';

interface IUpdateAppDialog {
app: ApplicationObject;
Expand All @@ -17,7 +16,6 @@ interface IUpdateAppDialog {

const UpdateAppDialog = ({ app, onClose }: IUpdateAppDialog) => {
const { send: updateApp, data, error, clear } = useWS('app_update');
const { currentLoginAccount } = useAuthContext();
const { getApps } = useAppManager();

const scopes = scopesArrayToObject(app.scopes);
Expand Down Expand Up @@ -46,11 +44,10 @@ const UpdateAppDialog = ({ app, onClose }: IUpdateAppDialog) => {
const onSubmit = useCallback(
(data: IRegisterAppForm) => {
const { name, redirect_uri, verification_uri, app_markup_percentage } = data;
const is_demo_account = currentLoginAccount.name.includes('VRTC');

const has_redirect_uri = redirect_uri !== '' && { redirect_uri };
const has_verification_uri = verification_uri !== '' && { verification_uri };
const can_have_markup = !is_demo_account && {
const markup = {
app_markup_percentage: Number(app_markup_percentage),
};

Expand All @@ -66,7 +63,7 @@ const UpdateAppDialog = ({ app, onClose }: IUpdateAppDialog) => {
name,
...has_redirect_uri,
...has_verification_uri,
...can_have_markup,
...markup,
scopes: selectedScopes,
});
},
Expand Down
7 changes: 2 additions & 5 deletions src/features/dashboard/register-app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,18 @@ import { scopesObjectToArray } from '@site/src/utils';
import { RegisterAppDialogError } from '../components/Dialogs/RegisterAppDialogError';
import { RegisterAppDialogSuccess } from '../components/Dialogs/RegisterAppDialogSuccess';
import { IRegisterAppForm } from '../types';
import useAuthContext from '@site/src/hooks/useAuthContext';

const AppRegistration = () => {
const { send: registerApp, error, clear, data } = useWS('app_register');
const { currentLoginAccount } = useAuthContext();
const [form_is_cleared, setFormIsCleared] = useState(false);

const onSubmit = useCallback(
(data: IRegisterAppForm) => {
const { name, redirect_uri, verification_uri, app_markup_percentage } = data;
const is_demo_account = currentLoginAccount.name.includes('VRTC');

const has_redirect_uri = redirect_uri !== '' && { redirect_uri };
const has_verification_uri = verification_uri !== '' && { verification_uri };
const can_have_markup = !is_demo_account && {
const markup = {
app_markup_percentage: Number(app_markup_percentage),
};

Expand All @@ -34,7 +31,7 @@ const AppRegistration = () => {
name,
...has_redirect_uri,
...has_verification_uri,
...can_have_markup,
...markup,
scopes: selectedScopes,
});
setFormIsCleared(true);
Expand Down

1 comment on commit 54c3e88

@vercel
Copy link

@vercel vercel bot commented on 54c3e88 Aug 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-api-docs – ./

deriv-api-docs.binary.sx
deriv-api-docs-git-master.binary.sx

Please sign in to comment.