You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
6.1 KiB

  1. import { lazy } from 'react';
  2. import { useEffect } from "react";
  3. // project import
  4. import Loadable from 'components/Loadable';
  5. // import MinimalLayout from 'layout/MinimalLayout';
  6. import MainLayout from 'layout/MainLayout';
  7. import { Navigate } from 'react-router-dom';
  8. // render - login
  9. const AuthLogin = Loadable(lazy(() => import('pages/authentication/Login')));
  10. const AuthRegister = Loadable(lazy(() => import('pages/authentication/RegisterCustom')));
  11. const RegisterForm = Loadable(lazy(() => import('pages/authentication/Register')));
  12. const BusRegisterForm = Loadable(lazy(() => import('pages/authentication/BusRegister')));
  13. const IAmSmartRegister = Loadable(lazy(() => import('pages/authentication/IAmSmartRegister')));
  14. const ErrorPage = Loadable(lazy(() => import('pages/extra-pages/ErrorPage')));
  15. const PrivacyPolicyPage = Loadable(lazy(() => import('pages/extra-pages/PrivacyPolicyPage')));
  16. const ImportantNoticePage = Loadable(lazy(() => import('pages/extra-pages/ImportantNoticePage')));
  17. const UserMenuPub1Page = Loadable(lazy(() => import('pages/extra-pages/UserMenuPub1')));
  18. const DatabaseHealthCheckPage = Loadable(lazy(() => import('pages/extra-pages/DatabaseHealthCheck')));
  19. const ForgotPassword = Loadable(lazy(() => import('pages/authentication/ForgotPassword')));
  20. const AfterForgotPasswordPage = Loadable(lazy(() => import('pages/authentication/ForgotPassword/AfterForgotPasswordPage')));
  21. const ForgotPassword_Callback = Loadable(lazy(() => import('pages/authentication/ForgotPassword/AuthCallback')));
  22. const ForgotPassword_Success = Loadable(lazy(() => import('pages/authentication/ForgotPassword/AuthCallback/ResetPasswordSuccess')));
  23. const ForgotUsername = Loadable(lazy(() => import('pages/authentication/ForgotUsername')));
  24. const AfterForgotUsernamePage = Loadable(lazy(() => import('pages/authentication/ForgotUsername/AfterForgotUsernamePage')));
  25. const ForgotUsername_Callback = Loadable(lazy(() => import('pages/authentication/ForgotUsername/AuthCallback')));
  26. const ForgotUsername_Success = Loadable(lazy(() => import('pages/authentication/ForgotUsername/AuthCallback/ResetPasswordSuccess')));
  27. const IAmSmart_DirectLoginCallback = Loadable(lazy(() => import('pages/iAmSmart/DirectLoginCallback')));
  28. //const IAmSmart_FallCallback = Loadable(lazy(() => import('pages/iAmSmart/FallCallback')));
  29. const IAmSmart_FailCallback = Loadable(lazy(() => import('pages/iAmSmart/FailCallback')));
  30. const FailCallback_VerifyMail = Loadable(lazy(() => import('pages/iAmSmart/FailCallback_VerifyMail')));
  31. const IAmSmart_AuthCallback = Loadable(lazy(() => import('pages/iAmSmart/AuthCallback')));
  32. const IAmSmart_RegistryCallback = Loadable(lazy(() => import('pages/iAmSmart/RegistryCallback')));
  33. const IAmSmart_PleaseLoginCallback = Loadable(lazy(() => import('pages/iAmSmart/PleaseLoginCallback')));
  34. //TODO: this page for testing only, please remove at prod
  35. const VerifyPage = Loadable(lazy(() => import('pages/authentication/Verify')));
  36. const Testfps = Loadable(lazy(() => import('pages/Payment/FPS/FPSTest')));
  37. const Payment_FPS_CallBack = Loadable(lazy(() => import('pages/Payment/FPS/fpscallback')));
  38. // ==============================|| AUTH ROUTING ||============================== //
  39. function ExternalRedirect({ to, replace = true }) {
  40. useEffect(() => {
  41. if (replace) window.location.replace(to);
  42. else window.location.href = to;
  43. }, [to, replace]);
  44. return null;
  45. }
  46. const LoginRoutes = {
  47. path: '/',
  48. element: <MainLayout />,
  49. children: [
  50. {
  51. path: 'login',
  52. element: <AuthLogin />
  53. },
  54. {
  55. path: 'register',
  56. element: <AuthRegister />
  57. },
  58. {
  59. path: 'registerFrom',
  60. element: <RegisterForm />
  61. },
  62. {
  63. path: 'registerFromOrganization',
  64. element: <BusRegisterForm />
  65. },
  66. {
  67. path: 'iAmSmartRegisterFrom',
  68. element: <IAmSmartRegister />
  69. },
  70. {
  71. path: 'error',
  72. element: <ErrorPage/>
  73. },
  74. {
  75. path: 'privacyPolicy',
  76. element: <PrivacyPolicyPage/>
  77. },
  78. {
  79. path: 'importantNotice',
  80. element: <ImportantNoticePage/>
  81. },
  82. {
  83. path: 'aboutUs',
  84. element: <ExternalRedirect to="https://www.gld.gov.hk/zh-cn/our-services/printing/advertising-gov-gazette/" />
  85. },
  86. {
  87. path: 'userGuide',
  88. element: <Navigate to="/userGuidePub" replace />
  89. },
  90. {
  91. path: 'userGuidePub',
  92. element: <UserMenuPub1Page/>
  93. },
  94. {
  95. path: 'userguide-fi',
  96. element: <Navigate to="/userGuidePub" replace />
  97. },
  98. {
  99. path: 'databaseHealthCheck',
  100. element: <DatabaseHealthCheckPage/>
  101. },
  102. {
  103. path: 'iamsmart/logincallback',
  104. element: <IAmSmart_DirectLoginCallback/>
  105. },
  106. {
  107. path: 'iamsmart/loginfallback',
  108. element: <IAmSmart_FailCallback/>
  109. },
  110. {
  111. path: 'iamsmart/notverify',
  112. element: <FailCallback_VerifyMail/>
  113. },
  114. {
  115. path: 'iamsmart/authcallback',
  116. element: <IAmSmart_AuthCallback/>
  117. },
  118. {
  119. path: 'iamsmart/registrycallback',
  120. element: <IAmSmart_RegistryCallback/>
  121. },
  122. {
  123. path: 'iamsmart/pleaseLogin',
  124. element: <IAmSmart_PleaseLoginCallback/>
  125. },
  126. {
  127. path: 'iamsmart/loginFail',
  128. element: <IAmSmart_FailCallback/>
  129. },
  130. {
  131. path: 'verify/:verifyCode/:email',
  132. element: <VerifyPage/>
  133. },
  134. {
  135. path: 'testfps',
  136. element: <Testfps/>
  137. },
  138. {
  139. path: 'testfpscallback',
  140. element: <Payment_FPS_CallBack/>
  141. },
  142. {
  143. path: 'forgot/password',
  144. element: <ForgotPassword/>
  145. },
  146. {
  147. path: 'forgot/password/sent',
  148. element: <AfterForgotPasswordPage/>
  149. },
  150. {
  151. path: 'forgot/password/verify/:verifyCode/:email',
  152. element: <ForgotPassword_Callback/>
  153. },
  154. {
  155. path: 'forgot/password/success',
  156. element: <ForgotPassword_Success/>
  157. },
  158. {
  159. path: 'forgot/username',
  160. element: <ForgotUsername/>
  161. },
  162. {
  163. path: 'forgot/username/sent',
  164. element: <AfterForgotUsernamePage/>
  165. },
  166. {
  167. path: 'forgot/username/verify/:verifyCode/:email',
  168. element: <ForgotUsername_Callback/>
  169. },
  170. {
  171. path: 'forgot/username/success',
  172. element: <ForgotUsername_Success/>
  173. },
  174. ]
  175. };
  176. export default LoginRoutes;