Merge branch 'iipbs/fo/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/fo/dev
This commit is contained in:
@@ -113,10 +113,10 @@ const RdiiChart = ({ pplMngNo }: ModalOpenProp) => {
|
|||||||
const rdiiRsltChart = () => { // 그래프 & 팝업 닫기
|
const rdiiRsltChart = () => { // 그래프 & 팝업 닫기
|
||||||
fetchFilteredData();
|
fetchFilteredData();
|
||||||
fn.selectPplRdiiQty(rainInfwtAnlsSn, pplMngNo).then((data) => {// 강우유입수량 조회
|
fn.selectPplRdiiQty(rainInfwtAnlsSn, pplMngNo).then((data) => {// 강우유입수량 조회
|
||||||
setRdiiQty(Math.round(data.rdiih*24).toLocaleString('ko-KR')); // cmd: m³/d 단위로 변환
|
setRdiiQty(Math.round(data?.rdiih*24).toLocaleString('ko-KR')); // cmd: m³/d 단위로 변환
|
||||||
if (data.raintotal && data.rainTotal !== 0) {
|
if (data?.raintotal && data?.rainTotal !== 0) {
|
||||||
setRainTotal(data.raintotal.toLocaleString('ko-KR')); // 총강우량mm
|
setRainTotal(data?.raintotal.toLocaleString('ko-KR')); // 총강우량mm
|
||||||
setTotalVolume(Math.round(data.rdiih * data.sustaintime / data.raintotal).toLocaleString('ko-KR')); // 총체적 m³/mm
|
setTotalVolume(Math.round(data?.rdiih * data?.sustaintime / data?.raintotal).toLocaleString('ko-KR')); // 총체적 m³/mm
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setPopupOpen(false);
|
setPopupOpen(false);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export const getData = async (url: string): Promise<any> => {
|
|||||||
|
|
||||||
// JSON 파싱 시도
|
// JSON 파싱 시도
|
||||||
const data = JSON.parse(text);
|
const data = JSON.parse(text);
|
||||||
return data;
|
return data.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('JSON parsing error:', error);
|
console.error('JSON parsing error:', error);
|
||||||
// JSON 파싱에 실패한 경우, 원본 텍스트 또는 null 반환
|
// JSON 파싱에 실패한 경우, 원본 텍스트 또는 null 반환
|
||||||
@@ -55,7 +55,8 @@ export const postData = async (url: string, data: object): Promise<any> => {
|
|||||||
const res = await fetch(`${BASE_URL}/${url}`, options);
|
const res = await fetch(`${BASE_URL}/${url}`, options);
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const resData = await res.json();
|
const resData = await res.json();
|
||||||
return resData;
|
console.log('postData response:', resData);
|
||||||
|
return resData.data;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -63,7 +64,8 @@ export const postMutiPart = async (url: string, data: FormData): Promise<any> =>
|
|||||||
const res = await axios.post(`${BASE_URL}/${url}`, data, {
|
const res = await axios.post(`${BASE_URL}/${url}`, data, {
|
||||||
timeout: 600000, // 10분
|
timeout: 600000, // 10분
|
||||||
});
|
});
|
||||||
return res.data;
|
console.log('postMultiPart response:', res);
|
||||||
|
return res.data.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putData = async (url: string, data: object): Promise<any> => {
|
export const putData = async (url: string, data: object): Promise<any> => {
|
||||||
@@ -76,7 +78,8 @@ export const putData = async (url: string, data: object): Promise<any> => {
|
|||||||
};
|
};
|
||||||
const res = await fetch(`${BASE_URL}/${url}`, options);
|
const res = await fetch(`${BASE_URL}/${url}`, options);
|
||||||
const resData = await res.json();
|
const resData = await res.json();
|
||||||
return resData;
|
console.log('putData response:', resData);
|
||||||
|
return resData.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteData = async (url: string, data?: object): Promise<any> => {
|
export const deleteData = async (url: string, data?: object): Promise<any> => {
|
||||||
|
|||||||
@@ -43,8 +43,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
|||||||
console.error("Token refresh failed:", refreshError);
|
console.error("Token refresh failed:", refreshError);
|
||||||
setUserInfo(null);
|
setUserInfo(null);
|
||||||
|
|
||||||
// const hostname = window.location.hostname;
|
const hostname = window.location.hostname;
|
||||||
const hostname = location.hostname;
|
|
||||||
|
|
||||||
// 개발 환경에서는 localhost 도메인 사용
|
// 개발 환경에서는 localhost 도메인 사용
|
||||||
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr")
|
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr")
|
||||||
@@ -52,7 +51,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
|||||||
|
|
||||||
// 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용
|
// 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용
|
||||||
// router.push는 같은 Next.js 앱 내에서만 작동하므로 다른 앱으로 이동할 때는 window.location.href 사용
|
// router.push는 같은 Next.js 앱 내에서만 작동하므로 다른 앱으로 이동할 때는 window.location.href 사용
|
||||||
if (hostname.includes("hasuon.or.kr")) location.href = LOGIN_PAGE_URL; // 세션 만료 시 CM 로그인 페이지로 리다이렉트
|
if (hostname.includes("hasuon.or.kr")) window.location.href = LOGIN_PAGE_URL; // 세션 만료 시 CM 로그인 페이지로 리다이렉트
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user