system alarm test

This commit is contained in:
hyunwoo93.cha
2024-07-01 18:09:16 +09:00
parent 04381ac428
commit 6550b28858
2 changed files with 17 additions and 89 deletions

View File

@@ -390,46 +390,33 @@ export const addReservation = (data) => (dispatch) => {
export const deleteReservation = (scheduleIdList) => (dispatch) => {
lunaSend.deleteReservation(scheduleIdList, {
onSuccess: (res) => {
console.log(res);
dispatch(alertToast("success" + JSON.stringify(res)));
},
onFailure: (err) => {
console.log(err);
dispatch(alertToast("failed" + JSON.stringify(err)));
},
});
};
export const searchReservation = (chanId) => (dispatch) => {
lunaSend.searchReservation(chanId, {
lunaSend.searchReservation({
onSuccess: (res) => {
console.log(res);
dispatch(alertToast(JSON.stringify(res)));
dispatch(alertToast("searchReservation onSuccessed"));
let items = [];
// let items = [];
// res.results.forEach((item) => {
// let obj = JSON.parse(item.information.information);
// items.push({
// _id: item._id,
// showId: obj.showId,
// });
// });
res.results.forEach((item) => {
let obj = JSON.parse(item.information.information);
items.push({
_id: item._id,
showId: obj.showId,
});
});
// let index = items.findIndex((item) => item.chanId === chanId);
// let deletedIdList = [];
// if (index !== -1) {
// deletedIdList.push(items[index]._id);
// dispatch(
// deleteReservation(deletedIdList, {
// onSuccess: (r) => {
// console.log(r);
// },
// onFailure: (e) => {
// console.log(e);
// },
// })
// );
// }
let index = items.findIndex((item) => item.chanId === chanId);
let deletedIdList = [];
if (index !== -1) {
deletedIdList.push(items[index]._id);
dispatch(deleteReservation(deletedIdList));
}
},
onFailure: (err) => {
console.log(err);

View File

@@ -102,67 +102,8 @@ export const setMainLiveUpcomingAlarm = (props) => (dispatch, getState) => {
}
//
else if (alamDispFlag === "N") {
// dispatch(deleteReservation(showId, {
// onSuccess: (res) => {
// console.log("LUNA SEND deleteReservation success", res);
// },
// onFailure: (err) => {
// console.log("LUNA SEND deleteReservation failed", err);
// },
// }))
dispatch(searchReservation(chanId));
}
/* ---------------------------------------------- example
if (alamDispFlag === "Y") {
const data = {
startTime: {
year: new Date(strtDt).getFullYear(),
month: new Date(strtDt).getMonth() + 1,
day: new Date(strtDt).getDate(),
hour: new Date(strtDt).getHours(),
minute: new Date(strtDt).getMinutes(),
second: new Date(strtDt).getSeconds()
},
params: {
message: "add Message",
buttons: [
{
label: HelperMethods.$L("yes")
},
{
label: HelperMethods.$L("no")
}
],
launch: {
contentTarget: `V3_진입경로코드_진입경로명_LS_${patnrId}_${chanId}`
},
showId: showId
}
}
dispatch(addReservation(data, {
onSuccess: (res) => {
console.log("LUNA SEND addReservation success", res);
},
onFailure: (err) => {
console.log("LUNA SEND addReservation failed", err);
}
}))
} else if (alamDispFlag === "N") {
dispatch(deleteReservation(showId, {
onSuccess: (res) => {
console.log("LUNA SEND deleteReservation success", res);
},
onFailure: (err) => {
console.log("LUNA SEND deleteReservation failed", err);
},
}))
}
---------------------------------------------- */
};
const onFail = (error) => {