diff --git a/com.twin.app.shoptime/src/actions/actionTypes.js b/com.twin.app.shoptime/src/actions/actionTypes.js index f5c20056..90c2dc21 100644 --- a/com.twin.app.shoptime/src/actions/actionTypes.js +++ b/com.twin.app.shoptime/src/actions/actionTypes.js @@ -27,6 +27,8 @@ export const types = { GET_TERMS_AGREE_YN: "GET_TERMS_AGREE_YN", SET_FOCUS: "SET_FOCUS", SET_GNB_MENU: "SET_GNB_MENU", + SET_SYSTEM_NOTICE: "SET_SYSTEM_NOTICE", + SET_SYSTEM_TERMINATION: "SET_SYSTEM_TERMINATION", // billing actions GET_MY_INFO_BILLING_SEARCH: "GET_MY_INFO_BILLING_SEARCH", diff --git a/com.twin.app.shoptime/src/actions/commonActions.js b/com.twin.app.shoptime/src/actions/commonActions.js index 8925ddb3..25e99b30 100644 --- a/com.twin.app.shoptime/src/actions/commonActions.js +++ b/com.twin.app.shoptime/src/actions/commonActions.js @@ -426,3 +426,12 @@ export const deleteReservation = (showId) => (dispatch) => { }, }); }; + +export const setSystemNotice = () => ({ + type: types.SET_SYSTEM_NOTICE, +}); + +export const setSystemTermination = (isinitialLoad) => ({ + tpe: types.SET_SYSTEM_TERMINATION, + payload: { isinitialLoad }, +}); diff --git a/com.twin.app.shoptime/src/api/TAxios.js b/com.twin.app.shoptime/src/api/TAxios.js index b70a186d..c8fe3633 100644 --- a/com.twin.app.shoptime/src/api/TAxios.js +++ b/com.twin.app.shoptime/src/api/TAxios.js @@ -7,6 +7,8 @@ import { changeAppStatus, changeLocalSettings, setShowPopup, + setSystemNotice, + setSystemTermination, } from "../actions/commonActions"; import { getAuthenticationCode, @@ -90,6 +92,18 @@ export const TAxios = ( axiosInstance .then((res) => { console.log("TAxios response", url, res); + + const apiSysStatus = res.headers["api-sys-status"]; + const { systemNotice, systemTermination, appStatus } = + getState().common; + const isInitialLoad = !appStatus.loadingComplete; + + if (apiSysStatus === "800" && !systemNotice) { + dispatch(setSystemNotice()); + } else if (apiSysStatus === "900" && !systemTermination) { + dispatch(setSystemTermination(isInitialLoad)); + } + if (baseUrl === URLS.GET_AUTHENTICATION_CODE) { if (res?.data?.retCode !== 0) { console.error("accessToken failed", res.data.retCode); diff --git a/com.twin.app.shoptime/src/components/SystemNotification/SystemNotification.jsx b/com.twin.app.shoptime/src/components/SystemNotification/SystemNotification.jsx new file mode 100644 index 00000000..211a434e --- /dev/null +++ b/com.twin.app.shoptime/src/components/SystemNotification/SystemNotification.jsx @@ -0,0 +1,34 @@ +import React, { useEffect } from "react"; + +import { useDispatch, useSelector } from "react-redux"; + +const SystemNotification = () => { + const dispatch = useDispatch(); + const { systemNotice, systemTermination } = useSelector( + (state) => state.common + ); + + useEffect(() => { + if (systemNotice) { + console.log("------------------- system notice -------------------"); + } + }, [systemNotice]); + + useEffect(() => { + if (systemTermination) { + if (systemTermination.isInitialLoad) { + console.log( + "------------------- Application will be shut down for server inspection (initial launch) -------------------" + ); + } else { + console.log( + "------------------- Application will be shut down for server inspection (using the app) -------------------" + ); + } + } + }, [systemTermination]); + + return null; +}; + +export default SystemNotification; diff --git a/com.twin.app.shoptime/src/components/SystemNotification/SystemNotification.module.less b/com.twin.app.shoptime/src/components/SystemNotification/SystemNotification.module.less new file mode 100644 index 00000000..e69de29b diff --git a/com.twin.app.shoptime/src/reducers/commonReducer.js b/com.twin.app.shoptime/src/reducers/commonReducer.js index 62c87f7e..382c3118 100644 --- a/com.twin.app.shoptime/src/reducers/commonReducer.js +++ b/com.twin.app.shoptime/src/reducers/commonReducer.js @@ -56,6 +56,9 @@ const initialState = { menuMovSno: 0, }, + systemNotice: false, + systemTermination: null, + // test spotlightId: null, }; @@ -221,6 +224,20 @@ export const commonReducer = (state = initialState, action) => { }; } + case types.SET_SYSTEM_NOTICE: { + return { + ...state, + systemNotice: true, + }; + } + + case types.SET_SYSTEM_TERMINATION: { + return { + ...state, + systemTermination: action.payload, + }; + } + default: return state; } diff --git a/com.twin.app.shoptime/src/views/MainView/MainView.jsx b/com.twin.app.shoptime/src/views/MainView/MainView.jsx index e3d342aa..37d262d2 100644 --- a/com.twin.app.shoptime/src/views/MainView/MainView.jsx +++ b/com.twin.app.shoptime/src/views/MainView/MainView.jsx @@ -27,6 +27,7 @@ import { pushPanel, resetPanels } from "../../actions/panelActions"; import Loader from "../../components/Loader/Loader"; import { convertUtcToLocal } from "../../components/MediaPlayer/util"; import PreloadImage from "../../components/PreloadImage/PreloadImage"; +import SystemNotification from "../../components/SystemNotification/SystemNotification"; import TabLayout from "../../components/TabLayout/TabLayout"; import TPopUp from "../../components/TPopUp/TPopUp"; import useLogService from "../../hooks/useLogService"; @@ -605,6 +606,7 @@ export default function MainView({ className }) { title={$L("Exit Shop Time")} /> )} + ); }