diff --git a/src/pages/authentication/auth-forms/IAmSmartFormWizard.js b/src/pages/authentication/auth-forms/IAmSmartFormWizard.js
index ee8f752..df10f15 100644
--- a/src/pages/authentication/auth-forms/IAmSmartFormWizard.js
+++ b/src/pages/authentication/auth-forms/IAmSmartFormWizard.js
@@ -83,7 +83,7 @@ const CustomFormWizard = (props) => {
const responseToData = () => {
//let rd = JSON.parse("{\"emailAddress\":\"test@gmail.com\",\"postalAddress\":{\"EngPremisesAddress\":{\"EngDistrict\":{\"DcDistrict\":\"KC\",\"Sub-district\":\"TSING YI\"},\"EngEstate\":{\"EstateName\":\"Cheung Hang Estate\",\"EngPhase\":{\"PhaseName\":\"N/A\"}},\"BuildingName\":\"Hang Lai House\",\"EngBlock\":{\"BlockDescriptor\":\"Block\",\"BlockNo\":\"2\"},\"Region\":\"NT\",\"EngStreet\":{\"StreetName\":\"Liu To Road\",\"BuildingNoFrom\":\"6\"},\"Eng3dAddress\":{\"EngFloor\":{\"FloorNum\":\"33\"},\"EngUnit\":{\"UnitDescriptor\":\"Room\",\"UnitNo\":\"3301\"}}}},\"mobileNumber\":{\"CountryCode\":\"852\",\"SubscriberNumber\":\"99999999\"},\"residentialAddress\":{\"ChiPremisesAddress\":{\"Chi3dAddress\":{\"ChiUnit\":{\"UnitDescriptor\":\"室\",\"UnitNo\":\"1010\"},\"ChiFloor\":{\"FloorNum\":\"10\"}},\"ChiBlock\":{\"BlockDescriptor\":\"座\",\"BlockNo\":\"2\"},\"BuildingName\":\"亨麗樓(第2座)\",\"ChiDistrict\":{\"DcDistrict\":\"KC\",\"Sub-district\":\"青衣\"},\"Region\":\"新界\",\"ChiEstate\":{\"EstateName\":\"長亨邨\"},\"ChiStreet\":{\"StreetName\":\"寮肚路\",\"BuildingNoFrom\":\"6\"}}},\"enName\":{\"UnstructuredName\":\"Testing Co One\"},\"idNo\":{\"Identification\":\"G561107\",\"CheckDigit\":\"4\"},\"chName\":{\"ChineseName\":\"測試商一\"}}");
- let rd = location.state?.responseData;
+ let rd = JSON.parse(location.state?.responseData.data);
let data = {
"enName": rd?.enName?.UnstructuredName ?? "",
"chName": rd?.chName?.ChineseName ?? "",
diff --git a/src/pages/iAmSmart/AuthCallback/index.js b/src/pages/iAmSmart/AuthCallback/index.js
index 7716ad5..5f30bb6 100644
--- a/src/pages/iAmSmart/AuthCallback/index.js
+++ b/src/pages/iAmSmart/AuthCallback/index.js
@@ -18,10 +18,10 @@ const Index = () => {
const navigate = useNavigate()
React.useEffect(() => {
- getPrfile();
+ goLogin();
}, []);
- function getPrfile(){
+ function goLogin(){
dispatch(handleLogoutFunction());
let params = new URLSearchParams(window.location.search)
@@ -32,10 +32,8 @@ const Index = () => {
code: params.get("code")
},
onSuccess: (responseData) => {
-
- //navigate('/iAmSmartRegisterFrom', { state: { responseData: responseData } });
-
- console.log(response)
+ console.log("responseData");
+ console.log(responseData);
const userData = {
id: responseData.id,
fullenName: responseData.name,
@@ -48,17 +46,17 @@ const Index = () => {
//avatar: require('src/assets/images/users/avatar-3.png').default,
}
const data = { ...userData, accessToken: responseData.accessToken, refreshToken: responseData.refreshToken }
- // setSuccess(true)
dispatch(handleLogin(data))
navigate('/dashboard');
- location.reload()
-
},
- onFail: ()=>{
- window.location.assign("/login");
+ onFail: (response)=>{
+ console.log("Fail");
+ console.log(response);
+ window.location.assign("/iamsmart/loginFail");
},
- onError:()=>{
- window.location.assign("/login");
+ onError:(error)=>{
+ console.log(error);
+ //window.location.assign("/iamsmart/loginFail");
}
});
}
diff --git a/src/routes/LoginRoutes.js b/src/routes/LoginRoutes.js
index 4b4d963..593a51e 100644
--- a/src/routes/LoginRoutes.js
+++ b/src/routes/LoginRoutes.js
@@ -57,10 +57,6 @@ const LoginRoutes = {
path: 'error',
element:
},
- {
- path: 'iamsmart/fallcallback',
- element:
- },
{
path: 'iamsmart/authcallback',
element:
@@ -70,7 +66,7 @@ const LoginRoutes = {
element:
},
{
- path: 'iamsmart/loginFall',
+ path: 'iamsmart/loginFail',
element:
},
{