From 068b4f308a824065e982c56f187f79871434eb22 Mon Sep 17 00:00:00 2001 From: jia-deriv <142988136+jia-deriv@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:16:41 +0800 Subject: [PATCH] chore: apply request changes (#759) --- src/javascript/app/pages/loader.jsx | 31 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/javascript/app/pages/loader.jsx b/src/javascript/app/pages/loader.jsx index 0d197051b7e..3bc7146c3f0 100644 --- a/src/javascript/app/pages/loader.jsx +++ b/src/javascript/app/pages/loader.jsx @@ -21,25 +21,26 @@ const PurchaseSectionLoader = ({ hideBottom }) => ( ); +const pageTypes = [ + { + name: '404', + code: '404', + }, + { + name: 'Trade', + code: 'trading', + }, + { + name: 'Endpoint', + code: 'endpoint', + }, +]; + const Loader = () => { const hasContractChange = useContractChange(); const [loading,setLoading] = useState(true); - const pageTypes = [ - { - name: '404', - code: '404', - }, - { - name: 'Trade', - code: 'trading', - }, - { - name: 'Endpoint', - code: 'endpoint', - }, - ]; - + const getPageType = () => pageTypes.find(({ code }) => window.location.pathname.includes(code)) || { name: 'Generic', code: '' }; const page = getPageType().name;