clean up, system alert

This commit is contained in:
younghoon100.park
2024-07-01 19:15:07 +09:00
parent abfc17e27d
commit e381632aa9
4 changed files with 21 additions and 66 deletions

View File

@@ -387,19 +387,21 @@ export const addReservation = (data) => (dispatch) => {
});
};
export const deleteReservation = (scheduleIdList) => (dispatch) => {
lunaSend.deleteReservation(scheduleIdList, {
export const deleteReservationCallback = (scheduleIdList) => (dispatch) => {
lunaSend.deleteReservationCallback(scheduleIdList, {
onSuccess: (res) => {
// pyh todo, deleted alertToast
dispatch(alertToast("success" + JSON.stringify(res)));
},
onFailure: (err) => {
// pyh todo, deleted alertToast
dispatch(alertToast("failed" + JSON.stringify(err)));
},
});
};
export const searchReservation = (showId) => (dispatch) => {
lunaSend.searchReservation({
export const deleteReservation = (showId) => (dispatch) => {
lunaSend.deleteReservation({
onSuccess: (res) => {
let items = [];
@@ -415,16 +417,12 @@ export const searchReservation = (showId) => (dispatch) => {
let deletedIdList = [];
if (index !== -1) {
dispatch(alertToast("if index is ", index));
deletedIdList.push(items[index]._id);
dispatch(deleteReservation(deletedIdList));
} else {
dispatch(alertToast("else index is ", index));
dispatch(deleteReservationCallback(deletedIdList));
}
},
onFailure: (err) => {
console.log(err);
dispatch(alertToast("searchReservation failed"));
},
});
};

View File

@@ -7,7 +7,6 @@ import {
addReservation,
changeAppStatus,
deleteReservation,
searchReservation,
} from "./commonActions";
export const getMainLiveShow = (props) => (dispatch, getState) => {
@@ -89,20 +88,11 @@ export const setMainLiveUpcomingAlarm = (props) => (dispatch, getState) => {
},
};
dispatch(
addReservation(data, {
onSuccess: (res) => {
console.log("LUNA SEND addReservation success", res);
},
onFailure: (err) => {
console.log("LUNA SEND addReservation failed", err);
},
})
);
dispatch(addReservation(data));
}
//
else if (alamDispFlag === "N") {
dispatch(searchReservation(showId));
dispatch(deleteReservation(showId));
}
};

View File

@@ -195,7 +195,7 @@ export const setSubtitleEnableOver5 = (
};
// system Alert
export const addReservation = (data) => {
export const addReservation = (data, { onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND addReservation data", data);
return;
@@ -242,21 +242,21 @@ export const addReservation = (data) => {
chanId: data.params.chanId,
},
},
onSuccess: (res) => {
console.log("LUNA SEND addReservation success", res);
},
onFailure: (err) => {
console.log("LUNA SEND addReservation failed", err);
},
onSuccess,
onFailure,
onComplete,
});
};
export const deleteReservation = (
export const deleteReservationCallback = (
scheduleIdList,
{ onSuccess, onFailure, onComplete }
) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND deleteReservation scheduleIdList", scheduleIdList);
console.log(
"LUNA SEND deleteReservationCallback scheduleIdList",
scheduleIdList
);
return;
}
@@ -272,9 +272,9 @@ export const deleteReservation = (
});
};
export const searchReservation = ({ onSuccess, onFailure, onComplete }) => {
export const deleteReservation = ({ onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND searchReservation chanId");
console.log("LUNA SEND deleteReservation");
return;
}

View File

@@ -19,11 +19,7 @@ import {
getBrandShowroom,
getBrandTSVInfo,
} from "../../actions/brandActions";
import {
changeAppStatus,
deleteReservation,
setHidePopup,
} from "../../actions/commonActions";
import { changeAppStatus, setHidePopup } from "../../actions/commonActions";
import { setMainLiveUpcomingAlarm } from "../../actions/mainActions";
import {
deleteMyUpcomingAlertShow,
@@ -599,36 +595,7 @@ export default function FeaturedBrandsPanel({
if (activePopup?.type === ACTIVE_POPUP.timeConflictPopup) {
const { upcomingAlarmInfo, deletedAlertShows } = activePopup;
/* ---------------------------------------------- example
dispatch(deleteReservation(deletedAlertShows, {
onSuccess: (res) => {
console.log("LUNA SEND deleteReservation success", res);
dispatch(setMainLiveUpcomingAlarm(upcomingAlarmInfo));
dispatch(deleteMyUpcomingAlertShow({ showList: deletedAlertShows }));
},
onFailure: (err) => {
console.log("LUNA SEND deleteReservation failed", err);
}
}));
---------------------------------------------- */
// dispatch(deleteReservation(deletedAlertShows, {
// onSuccess: (res) => {
// console.log("LUNA SEND deleteReservation success", res);
// dispatch(setMainLiveUpcomingAlarm(upcomingAlarmInfo));
// dispatch(deleteMyUpcomingAlertShow({ showList: deletedAlertShows }));
// },
// onFailure: (err) => {
// console.log("LUNA SEND deleteReservation failed", err);
// }
// }));
//
dispatch(setMainLiveUpcomingAlarm(upcomingAlarmInfo));
// showList, { patnrId: number, showId: string }[]
dispatch(deleteMyUpcomingAlertShow({ showList: deletedAlertShows }));
alamTimer.current = setTimeout(