diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js
index 5d35504..94fcab7 100644
--- a/src/pages/authentication/auth-forms/CustomFormWizard.js
+++ b/src/pages/authentication/auth-forms/CustomFormWizard.js
@@ -73,6 +73,12 @@ const CustomFormWizard = (props) => {
console.log(data.fax)
console.log(data.phone)
const name = data.ehName +" "+ data.enName
+ const userAddress = {
+ "addressLine1":data.address1,
+ "addressLine2":data.address2,
+ "addressLine3":data.address3,
+ "country":data.address5
+ }
console.log(name)
if (data.username !==""){
axios.post(`${apiPath}/user/register`, {
@@ -82,13 +88,9 @@ const CustomFormWizard = (props) => {
fullname: name,
enName: data.enName,
chName: data.chName,
- email: data.email,
+ emailAddress: data.email,
fax: data.fax,
- address1: data.address1,
- address2: data.address2,
- address3: data.address3,
- address4: data.address4,
- address5: data.address5
+ userAddress:userAddress
})
.then((response) => {
console.log("Success")
@@ -117,6 +119,7 @@ const CustomFormWizard = (props) => {
confirmPassword: '',
phone:'',
idNo:'',
+ checkDigit:'',
submit: null
}}
validationSchema={Yup.object().shape({
@@ -130,6 +133,7 @@ const CustomFormWizard = (props) => {
address3: Yup.string().max(255).required('請輸入第三行地址'),
email: Yup.string().email('Must be a valid email').max(255).required('Email is required'),
idNo: Yup.string().max(255).required('請輸入身證件號碼'),
+ checkDigit:Yup.string().max(1).required('請輸入身證件號碼'),
idType: Yup.string().max(255).required('請輸入第三行地址'),
})}
>
@@ -175,99 +179,103 @@ const CustomFormWizard = (props) => {
)}
-
-
-
- 密碼
- *
-
- 密碼規則
-
- {
- handleChange(e);
- changePassword(e.target.value);
- }}
- endAdornment={
-
-
- {showPassword ? : }
-
-
- }
- placeholder="密碼"
- inputProps={{}}
- />
- {touched.password && errors.password && (
-
- {errors.password}
-
- )}
-
-
-
-
-
-
-
-
- {level?.label}
-
+
+
+
+
+
+ 密碼
+ *
+
+ 密碼規則
+
+ {
+ handleChange(e);
+ changePassword(e.target.value);
+ }}
+ endAdornment={
+
+
+ {showPassword ? : }
+
+
+ }
+ placeholder="密碼"
+ inputProps={{}}
+ />
+ {touched.password && errors.password && (
+
+ {errors.password}
+
+ )}
+
+
+
+
+
+
+
+
+ {level?.label}
+
+
+
+
+
+
+ 確認密碼
+ *
+
+ {
+ handleChange(e);
+ changePassword(e.target.value);
+ }}
+ endAdornment={
+
+
+ {showConfirmPassword ? : }
+
+
+ }
+ placeholder="確認密碼"
+ fullWidth
+ error={Boolean(touched.confirmPassword && errors.confirmPassword)}
+ />
+ {touched.confirmPassword && errors.confirmPassword && (
+
+ {errors.confirmPassword}
+
+ )}
+
+
-
-
-
-
- 確認密碼
- *
-
- {
- handleChange(e);
- changePassword(e.target.value);
- }}
- endAdornment={
-
-
- {showConfirmPassword ? : }
-
-
- }
- placeholder="確認密碼"
- fullWidth
- error={Boolean(touched.confirmPassword && errors.confirmPassword)}
- />
- {touched.confirmPassword && errors.confirmPassword && (
-
- {errors.confirmPassword}
-
- )}
-
@@ -314,7 +322,7 @@ const CustomFormWizard = (props) => {
-
+
{
onChange={handleChange}
placeholder="證件號碼"
fullWidth
+ sx={{mr:1}}
error={Boolean(touched.idNo && errors.idNo)}
/>
{touched.idNo && errors.idNo && (
@@ -334,6 +343,27 @@ const CustomFormWizard = (props) => {
)}
+
+
+
+ {touched.checkDigit && errors.checkDigit && (
+
+ {errors.checkDigit}
+
+ )}
+
+
diff --git a/src/pages/extra-pages/LoadingComponent.js b/src/pages/extra-pages/LoadingComponent.js
index f5b30c3..a4ceba4 100644
--- a/src/pages/extra-pages/LoadingComponent.js
+++ b/src/pages/extra-pages/LoadingComponent.js
@@ -7,7 +7,7 @@ const LoadingComponent = () => {
display="flex"
justifyContent="center"
alignItems="center"
- autoHeight
+ autoHeight="true"
>
diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js
index d4d0494..7bf56d2 100644
--- a/src/routes/MainRoutes.js
+++ b/src/routes/MainRoutes.js
@@ -26,10 +26,6 @@ const MainRoutes = {
path: '/',
element:
},
- {
- path: 'color',
- element:
- },
{
path: '/',
children: [
@@ -39,6 +35,10 @@ const MainRoutes = {
}
]
},
+ {
+ path: 'color',
+ element:
+ },
{
path: 'sample-page',
element:
diff --git a/src/routes/index.js b/src/routes/index.js
index 8f99933..5e044c4 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -4,26 +4,17 @@ import MainRoutes from './MainRoutes'
import {useRoutes} from 'react-router-dom'
import {isUserLoggedIn} from "utils/Utils";
import {Navigate} from "react-router";
-import {useDispatch} from "react-redux";
-import {handleLogoutFunction,
+import {
setupAxiosInterceptors,
- isTokenValid} from "../auth";
-import {useNavigate} from "react-router-dom";
+ } from "../auth";
import SettingRoutes from './SettingRoutes';
// ==============================|| ROUTING RENDER ||============================== //
export default function ThemeRoutes() {
- const dispatch = useDispatch()
- const navigate = useNavigate()
if(isUserLoggedIn()){
- setupAxiosInterceptors();
-
//auto logout if token not valid
- if(!isTokenValid()){
- dispatch(handleLogoutFunction());
- navigate('/login');
- }
+ setupAxiosInterceptors();
}
return useRoutes([{
@@ -41,9 +32,15 @@ export default function ThemeRoutes() {
})
]
},
- LoginRoutes,
- MainRoutes,
- SettingRoutes
+ isUserLoggedIn() ? MainRoutes : LoginRoutes,
+ isUserLoggedIn() ? SettingRoutes : LoginRoutes,
+ !isUserLoggedIn()?{
+ path: '*',
+ element:
+ }:
+ {
+ path: '*',
+ element:
+ },
]);
- //return useRoutes([MainRoutes, LoginRoutes]);
}