From 640b27b533e892b6dc76f0c3443b69b0de78792f Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 10 Nov 2023 15:18:05 +0800 Subject: [PATCH] add callback page --- src/auth/utils.js | 5 +- src/pages/iAmSmart/FailCallback/index.js | 66 +++++++++++++++++++++ src/pages/iAmSmart/SuccessCallback/index.js | 66 +++++++++++++++++++++ src/routes/LoginRoutes.js | 16 ++++- 4 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 src/pages/iAmSmart/FailCallback/index.js create mode 100644 src/pages/iAmSmart/SuccessCallback/index.js diff --git a/src/auth/utils.js b/src/auth/utils.js index e5440d9..9c99e55 100644 --- a/src/auth/utils.js +++ b/src/auth/utils.js @@ -13,7 +13,10 @@ export const hostPath = `http://${hostname}:${hostPort}`; export const apiPath = `${hostPath}/api`; // export const apiPath = `/api`; export const paymentPath = `http://pnspsdev.gld.gov.hk/payment`; -export const iAmSmartPath = `https://`; +export const iAmSmartPath = `https://apigw-isit.staging-eid.gov.hk`; + +// clientId : cf61fa7c121e4869966f69c8694b1cd2 + export const isUserLoggedIn = () => { diff --git a/src/pages/iAmSmart/FailCallback/index.js b/src/pages/iAmSmart/FailCallback/index.js new file mode 100644 index 0000000..e908b83 --- /dev/null +++ b/src/pages/iAmSmart/FailCallback/index.js @@ -0,0 +1,66 @@ +// material-ui +import { + Grid, + Typography, + Stack, +} from '@mui/material'; +import * as React from "react"; + +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); + +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: '100%', + height: '100%', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' +} + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const Index = () => { + + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + setOnReady(true); + }, []); + + return ( + !onReady ? + + : + + +
+ + iAmSmart 登入失敗 + +
+
+ {/*row 1*/} + + +
+ + + + 連接 iAM Smart 時出現錯誤,請重試。 + + + +
+
+
+ {/*row 2*/} +
+ + + ); +}; + +export default Index; \ No newline at end of file diff --git a/src/pages/iAmSmart/SuccessCallback/index.js b/src/pages/iAmSmart/SuccessCallback/index.js new file mode 100644 index 0000000..15ff2e3 --- /dev/null +++ b/src/pages/iAmSmart/SuccessCallback/index.js @@ -0,0 +1,66 @@ +// material-ui +import { + Grid, + Typography, + Stack, +} from '@mui/material'; +import * as React from "react"; + +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); + +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: '100%', + height: '100%', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' +} + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const Index = () => { + + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + setOnReady(true); + }, []); + + return ( + !onReady ? + + : + + +
+ + iAmSmart 成功登入 + +
+
+ {/*row 1*/} + + +
+ + + + iAmSmart 成功登入 + + + +
+
+
+ {/*row 2*/} +
+ + + ); +}; + +export default Index; diff --git a/src/routes/LoginRoutes.js b/src/routes/LoginRoutes.js index a7b48af..99c9bc4 100644 --- a/src/routes/LoginRoutes.js +++ b/src/routes/LoginRoutes.js @@ -11,6 +11,10 @@ const AuthRegister = Loadable(lazy(() => import('pages/authentication/RegisterCu const RegisterForm = Loadable(lazy(() => import('pages/authentication/Register'))); const BusRegisterForm = Loadable(lazy(() => import('pages/authentication/BusRegister'))); const ErrorPage = Loadable(lazy(() => import('pages/extra-pages/ErrorPage'))); +const IAmSmart_FailCallback = Loadable(lazy(() => import('pages/iAmSmart/FailCallback'))); +const IAmSmart_SuccessCallback = Loadable(lazy(() => import('pages/iAmSmart/SuccessCallback'))); + +//TODO: this page for testing only, please remove at prod const TestMailPage = Loadable(lazy(() => import('pages/pnspsNotifyTest'))); // ==============================|| AUTH ROUTING ||============================== // @@ -19,6 +23,10 @@ const LoginRoutes = { path: '/', element: , children: [ + {//TODO: this page for testing only, please remove at prod + path: 'testMailPage', + element: + }, { path: 'login', element: @@ -40,8 +48,12 @@ const LoginRoutes = { element: }, { - path: 'testMailPage', - element: + path: 'iamsmart/loginfailback', + element: + }, + { + path: 'iamsmart/logincallback', + element: } ] };