system notice check
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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 },
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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")}
|
||||
/>
|
||||
)}
|
||||
<SystemNotification />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user