@@ -26,6 +26,7 @@ export const I18nProvider = ({ children }) => { | |||||
setLocale(localStorage.getItem('locale')); | setLocale(localStorage.getItem('locale')); | ||||
} | } | ||||
}, []); | }, []); | ||||
useEffect(() => { | useEffect(() => { | ||||
// Load the messages for the selected locale | // Load the messages for the selected locale | ||||
const fetchMessages = async () => { | const fetchMessages = async () => { | ||||
@@ -2,7 +2,9 @@ import { createContext, useEffect, useRef, useCallback } from 'react'; | |||||
import { apiPath } from 'auth/utils'; | import { apiPath } from 'auth/utils'; | ||||
import { REFRESH_TOKEN } from 'utils/ApiPathConst'; | import { REFRESH_TOKEN } from 'utils/ApiPathConst'; | ||||
import axios from 'axios'; | import axios from 'axios'; | ||||
import { | |||||
isUserLoggedIn, | |||||
} from "utils/Utils"; | |||||
const RefreshTokenContext = createContext(); | const RefreshTokenContext = createContext(); | ||||
const RefreshTokenProvider = ({ children }) => { | const RefreshTokenProvider = ({ children }) => { | ||||
@@ -55,7 +57,9 @@ const RefreshTokenProvider = ({ children }) => { | |||||
// console.log('accessToken: ' + localStorage.getItem('accessToken')); | // console.log('accessToken: ' + localStorage.getItem('accessToken')); | ||||
// console.log('refreshToken: ' + localStorage.getItem('refreshToken')); | // console.log('refreshToken: ' + localStorage.getItem('refreshToken')); | ||||
if (currentTime >= expiryTime) { | if (currentTime >= expiryTime) { | ||||
handleRefreshToken(); | |||||
if(isUserLoggedIn()){ | |||||
handleRefreshToken(); | |||||
} | |||||
} | } | ||||
} | } | ||||
}, [token]); | }, [token]); | ||||
@@ -18,7 +18,7 @@ import Transitions from 'components/@extended/Transitions'; | |||||
import LanguageIcon from '@mui/icons-material/Language'; | import LanguageIcon from '@mui/icons-material/Language'; | ||||
import {FormattedMessage} from "react-intl"; | import {FormattedMessage} from "react-intl"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import LocaleContext from "../../../../components/I18nProvider"; | |||||
import LocaleContext from "components/I18nProvider"; | |||||
// ==============================|| HEADER CONTENT - NOTIFICATION ||============================== // | // ==============================|| HEADER CONTENT - NOTIFICATION ||============================== // | ||||
@@ -98,7 +98,7 @@ const UserSearchPage_Individual = () => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
: | : | ||||
<Grid container sx={{ backgroundColor: 'backgroundColor.default' }} direction="column"> | |||||
<Grid container sx={{ minHeight: '95vh', backgroundColor: 'backgroundColor.default' }} direction="column"> | |||||
<Grid item xs={12}> | <Grid item xs={12}> | ||||
<div style={BackgroundHead}> | <div style={BackgroundHead}> | ||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | ||||
@@ -71,7 +71,7 @@ const OrganizationSearchPage = () => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
: | : | ||||
<Grid container sx={{backgroundColor:"backgroundColor.default"}}> | |||||
<Grid container sx={{minHeight: '95vh', backgroundColor:"backgroundColor.default"}} direction="column"> | |||||
<Grid item xs={12}> | <Grid item xs={12}> | ||||
<div style={BackgroundHead}> | <div style={BackgroundHead}> | ||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | ||||
@@ -96,7 +96,7 @@ const UserSearchPage_Individual = () => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
: | : | ||||
<Grid container sx={{ backgroundColor: 'backgroundColor.default' }} direction="column" | |||||
<Grid container sx={{ minHeight: '95vh', backgroundColor: 'backgroundColor.default' }} direction="column" | |||||
> | > | ||||
<Grid item xs={12}> | <Grid item xs={12}> | ||||
<div style={BackgroundHead}> | <div style={BackgroundHead}> | ||||
@@ -108,7 +108,7 @@ const PublicNotice = () => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
: | : | ||||
<Grid container> | |||||
<Grid container sx={{ minHeight: '95vh', backgroundColor:'backgroundColor.default'}} direction="column"> | |||||
<Grid item xs={12}> | <Grid item xs={12}> | ||||
<div style={BackgroundHead}> | <div style={BackgroundHead}> | ||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | ||||
@@ -96,7 +96,7 @@ const UserSearchPage_Individual = () => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
: | : | ||||
<Grid container sx={{ backgroundColor: 'backgroundColor.default' }}> | |||||
<Grid container sx={{ minHeight: '95vh',backgroundColor: 'backgroundColor.default' }} direction="column"> | |||||
<Grid item xs={12}> | <Grid item xs={12}> | ||||
<div style={BackgroundHead}> | <div style={BackgroundHead}> | ||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | ||||
@@ -185,7 +185,7 @@ const UserMaintainPage_Organization = () => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
: | : | ||||
<Grid container sx={{ backgroundColor: isGLDLoggedIn()?'backgroundColor.default':'#ffffff' }}> | |||||
<Grid container sx={{ minHeight: '95vh', backgroundColor: isGLDLoggedIn()?'backgroundColor.default':'#ffffff' }} direction="column"> | |||||
<Grid item xs={12}> | <Grid item xs={12}> | ||||
<div style={BackgroundHead}> | <div style={BackgroundHead}> | ||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | ||||
@@ -72,7 +72,7 @@ const UserSearchPage_Organization = () => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
: | : | ||||
<Grid container sx={{backgroundColor:"backgroundColor.default"}}> | |||||
<Grid container sx={{minHeight: '95vh',backgroundColor:"backgroundColor.default"}} direction="column"> | |||||
<Grid item xs={12}> | <Grid item xs={12}> | ||||
<div style={BackgroundHead}> | <div style={BackgroundHead}> | ||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | ||||
@@ -15,8 +15,8 @@ import { | |||||
import { useFormik } from 'formik'; | import { useFormik } from 'formik'; | ||||
import * as yup from 'yup'; | import * as yup from 'yup'; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
// import * as HttpUtils from "utils/HttpUtils"; | |||||
// import * as UrlUtils from "utils/ApiPathConst"; | |||||
import * as HttpUtils from "utils/HttpUtils"; | |||||
import * as UrlUtils from "utils/ApiPathConst"; | |||||
// import * as FieldUtils from "utils/FieldUtils"; | // import * as FieldUtils from "utils/FieldUtils"; | ||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | ||||
import ForwardIcon from '@mui/icons-material/Forward'; | import ForwardIcon from '@mui/icons-material/Forward'; | ||||
@@ -60,32 +60,23 @@ const ForgotPasswordApplyForm = () => { | |||||
}), | }), | ||||
onSubmit: values => { | onSubmit: values => { | ||||
console.log(values) | console.log(values) | ||||
navigate('/forgot/password/sent'); | |||||
// HttpUtils.postWithFiles({ | |||||
// url: UrlUtils.POST_PUBLIC_NOTICE_APPLY, | |||||
// params: { | |||||
// id: 0, | |||||
// contactPerson: values.contactPerson, | |||||
// contactTelNo: { | |||||
// countryCode: values.tel_countryCode, | |||||
// phoneNumber: values.phoneNumber | |||||
// }, | |||||
// contactFaxNo: { | |||||
// countryCode: values.fax_countryCode, | |||||
// faxNumber: values.faxNumber | |||||
// }, | |||||
// issueId: issueId, | |||||
// careOf: values.careOf ? values.careOf: "", | |||||
// remarks: values.remarks ? values.remarks : "", | |||||
// }, | |||||
// // files: [attachment], | |||||
// onSuccess: function () { | |||||
// notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') | |||||
// navigate("/publicNotice"); | |||||
// // location.reload(); | |||||
// } | |||||
// }); | |||||
HttpUtils.post({ | |||||
url: UrlUtils.POST_FORGOT_PASSWORD_EMAIL, | |||||
params: { | |||||
username: values.username, | |||||
}, | |||||
// files: [attachment], | |||||
onSuccess: function () { | |||||
// notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') | |||||
navigate('/forgot/password/sent'); | |||||
console.log("jjj") | |||||
// location.reload(); | |||||
}, | |||||
onError:function () { | |||||
navigate('/forgot/password/sent'); | |||||
console.log("hihihi") | |||||
} | |||||
}); | |||||
} | } | ||||
}); | }); | ||||
@@ -1,7 +1,8 @@ | |||||
import React, { | import React, { | ||||
useEffect, | useEffect, | ||||
useState, | useState, | ||||
lazy, useContext | |||||
lazy, | |||||
// useContext | |||||
} from 'react'; | } from 'react'; | ||||
import { Link as RouterLink } from 'react-router-dom'; | import { Link as RouterLink } from 'react-router-dom'; | ||||
import { useNavigate } from 'react-router-dom'; | import { useNavigate } from 'react-router-dom'; | ||||
@@ -42,17 +43,17 @@ import { EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons'; | |||||
import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png'; | import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png'; | ||||
import { useDispatch } from "react-redux"; | import { useDispatch } from "react-redux"; | ||||
import { handleLogin } from "auth/index"; | import { handleLogin } from "auth/index"; | ||||
import useJwt from "../../../auth/jwt/useJwt"; | |||||
import useJwt from "auth/jwt/useJwt"; | |||||
import { handleLogoutFunction } from 'auth/index'; | import { handleLogoutFunction } from 'auth/index'; | ||||
import {FormattedMessage, useIntl} from "react-intl"; | import {FormattedMessage, useIntl} from "react-intl"; | ||||
import LocaleContext from "../../../components/I18nProvider"; | |||||
// import LocaleContext from "components/I18nProvider"; | |||||
// ============================|| FIREBASE - LOGIN ||============================ // | // ============================|| FIREBASE - LOGIN ||============================ // | ||||
const AuthLoginCustom = () => { | const AuthLoginCustom = () => { | ||||
const dispatch = useDispatch() | const dispatch = useDispatch() | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const { setLocale } = useContext(LocaleContext); | |||||
// const { setLocaleFromLogin } = useContext(LocaleContext); | |||||
const [showPassword, setShowPassword] = useState(false); | const [showPassword, setShowPassword] = useState(false); | ||||
const handleClickShowPassword = () => { | const handleClickShowPassword = () => { | ||||
@@ -93,15 +94,15 @@ const AuthLoginCustom = () => { | |||||
// setSuccess(true) | // setSuccess(true) | ||||
// console.log(response.data); | // console.log(response.data); | ||||
if(response.data.type === "GLD"){ | if(response.data.type === "GLD"){ | ||||
setLocale("en"); | |||||
// setLocale("en"); | |||||
localStorage.setItem('locale','en'); | localStorage.setItem('locale','en'); | ||||
}else{ | }else{ | ||||
if (response.data.preferLocale ==="zh_HK"){ | if (response.data.preferLocale ==="zh_HK"){ | ||||
setLocale("zh-HK"); | |||||
// setLocale("zh-HK"); | |||||
localStorage.setItem('locale','zh-HK'); | localStorage.setItem('locale','zh-HK'); | ||||
} | } | ||||
if (response.data.preferLocale ==="zh-CN"){ | if (response.data.preferLocale ==="zh-CN"){ | ||||
setLocale("zh-CN"); | |||||
// setLocale("zh-CN"); | |||||
localStorage.setItem('locale','zh-CN'); | localStorage.setItem('locale','zh-CN'); | ||||
} | } | ||||
} | } | ||||
@@ -50,15 +50,15 @@ const Index = () => { | |||||
} | } | ||||
const data = { ...userData, accessToken: responseData.accessToken, refreshToken: responseData.refreshToken } | const data = { ...userData, accessToken: responseData.accessToken, refreshToken: responseData.refreshToken } | ||||
if(responseData.type === "GLD"){ | if(responseData.type === "GLD"){ | ||||
setLocale("en"); | |||||
// setLocale("en"); | |||||
localStorage.setItem('locale','en'); | localStorage.setItem('locale','en'); | ||||
}else{ | }else{ | ||||
if (responseData.preferLocale ==="zh_HK"){ | if (responseData.preferLocale ==="zh_HK"){ | ||||
setLocale("zh-HK"); | |||||
// setLocale("zh-HK"); | |||||
localStorage.setItem('locale','zh-HK'); | localStorage.setItem('locale','zh-HK'); | ||||
} | } | ||||
if (responseData.preferLocale ==="zh-CN"){ | if (responseData.preferLocale ==="zh-CN"){ | ||||
setLocale("zh-CN"); | |||||
// setLocale("zh-CN"); | |||||
localStorage.setItem('locale','zh-CN'); | localStorage.setItem('locale','zh-CN'); | ||||
} | } | ||||
} | } | ||||
@@ -75,6 +75,7 @@ export const GET_ID = apiPath+'/user/verifyID'; | |||||
export const GET_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyEmail'; | export const GET_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyEmail'; | ||||
export const GET_FORGOT_PASSWORD_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyForgotPasswordEmail'; | export const GET_FORGOT_PASSWORD_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyForgotPasswordEmail'; | ||||
export const POST_FORGOT_PASSWORD_NEW_PASSWORD = apiPath+'/user/forgotPasswordNewPassword'; | export const POST_FORGOT_PASSWORD_NEW_PASSWORD = apiPath+'/user/forgotPasswordNewPassword'; | ||||
export const POST_FORGOT_PASSWORD_EMAIL = apiPath+'/user/sendForgotPasswordEmail'; | |||||
//Public | //Public | ||||