merchant-backoffice

ZZZ: Inactive/Deprecated
Log | Files | Refs | Submodules | README

commit 4612814197db50c7e34763fee6b6568f87941559
parent cdc8080d082209492ff8b217cd71d7978a34661b
Author: Sebastian <sebasjm@gmail.com>
Date:   Thu, 25 Feb 2021 19:07:00 -0300

do not show error on first login

Diffstat:
Mpackages/frontend/src/index.tsx | 17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/packages/frontend/src/index.tsx b/packages/frontend/src/index.tsx @@ -71,7 +71,7 @@ export default function Application(): VNode { function ApplicationStatusRoutes(): VNode { const { notifications, pushNotification, removeNotification } = useNotifications() - const { lang, setLang, changeBackend, updateToken } = useContext(BackendContext) + const { lang, setLang, changeBackend, updateToken, token } = useContext(BackendContext) const backendConfig = useBackendConfig(); const i18n = useMessageTemplate() @@ -84,10 +84,23 @@ function ApplicationStatusRoutes(): VNode { const v = backendConfig.data?.currency + ' ' + backendConfig.data?.version const ctx = useMemo(() => ({ currency: backendConfig.data?.currency || '', version: backendConfig.data?.version || '' }), [v]) + if (!token) { + return <div id="app"> + <NavigationBar lang={lang} setLang={setLang} /> + <LoginPage + onConfirm={(url: string, token?: string) => { + changeBackend(url) + if (token) updateToken(token) + route(RootPaths.list_instances) + }} + /> + </div> + } + if (!backendConfig.data) { if (!backendConfig.error) return <div class="is-loading"></div> if (backendConfig.unauthorized) return <div class="asd">asd </div> - + return <div id="app"> <NavigationBar lang={lang} setLang={setLang} /> <LoginPage