From c11e9f1fbebec3442718e0178b6f94fa159641d0 Mon Sep 17 00:00:00 2001 From: Hubert Koster Date: Wed, 23 Aug 2023 17:18:00 +0200 Subject: [PATCH 1/3] chore: fixing markup --- .../dashboard/components/Dialogs/UpdateAppDialog/index.tsx | 5 ++--- src/features/dashboard/register-app/index.tsx | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx b/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx index 6cb34973..648382e0 100644 --- a/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx +++ b/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx @@ -46,11 +46,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), }; @@ -66,7 +65,7 @@ const UpdateAppDialog = ({ app, onClose }: IUpdateAppDialog) => { name, ...has_redirect_uri, ...has_verification_uri, - ...can_have_markup, + ...markup, scopes: selectedScopes, }); }, diff --git a/src/features/dashboard/register-app/index.tsx b/src/features/dashboard/register-app/index.tsx index c1205a48..4c1e62cd 100644 --- a/src/features/dashboard/register-app/index.tsx +++ b/src/features/dashboard/register-app/index.tsx @@ -9,17 +9,16 @@ import useAuthContext from '@site/src/hooks/useAuthContext'; const AppRegistration = () => { const { send: registerApp, error, clear, data } = useWS('app_register'); - const { currentLoginAccount } = useAuthContext(); + const { loginAccounts } = 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), }; @@ -34,7 +33,7 @@ const AppRegistration = () => { name, ...has_redirect_uri, ...has_verification_uri, - ...can_have_markup, + ...markup, scopes: selectedScopes, }); setFormIsCleared(true); From d552930a89ee9fd77adc84ed93fb9d1dac8b377b Mon Sep 17 00:00:00 2001 From: Hubert Koster Date: Wed, 23 Aug 2023 17:20:15 +0200 Subject: [PATCH 2/3] chore: removing unnecessary code --- .../dashboard/components/Dialogs/UpdateAppDialog/index.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx b/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx index 648382e0..7f8e8297 100644 --- a/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx +++ b/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx @@ -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; @@ -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); From c4680332e86ba64013861eedc3206ac8987bcc6b Mon Sep 17 00:00:00 2001 From: Hubert Koster Date: Wed, 23 Aug 2023 17:20:54 +0200 Subject: [PATCH 3/3] chore: removing more unnecessary code --- src/features/dashboard/register-app/index.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/features/dashboard/register-app/index.tsx b/src/features/dashboard/register-app/index.tsx index 4c1e62cd..09bb916f 100644 --- a/src/features/dashboard/register-app/index.tsx +++ b/src/features/dashboard/register-app/index.tsx @@ -5,11 +5,9 @@ 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 { loginAccounts } = useAuthContext(); const [form_is_cleared, setFormIsCleared] = useState(false); const onSubmit = useCallback(