[FeaturedBrandsPanel] test, system alert (luna)

This commit is contained in:
younghoon100.park
2024-06-28 16:58:19 +09:00
parent 05a22e09eb
commit 8b75347763
2 changed files with 59 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
import { URLS } from "../api/apiConfig";
import { TAxios } from "../api/TAxios";
import { searchReservation } from "../lunaSend";
import { CATEGORY_DATA_MAX_RESULTS_LIMIT } from "../utils/Config";
import * as HelperMethods from "../utils/helperMethods";
import { types } from "./actionTypes";
@@ -92,7 +93,6 @@ export const setMainLiveUpcomingAlarm = (props) => (dispatch, getState) => {
console.log("LUNA SEND addReservation success", res);
},
onFailure: (err) => {
// todo pyh, add callback in case of failure
console.log("LUNA SEND addReservation failed", err);
},
})
@@ -100,17 +100,30 @@ export const setMainLiveUpcomingAlarm = (props) => (dispatch, getState) => {
}
//
else if (alamDispFlag === "N") {
dispatch(
deleteReservation(showId, {
onSuccess: (res) => {
console.log("LUNA SEND deleteReservation success", res);
},
onFailure: (err) => {
// todo pyh, add callback in case of failure
console.log("LUNA SEND deleteReservation failed", err);
},
})
);
dispatch(searchReservation(), {
onSuccess: (res) => {
console.log("LUNA SEND searchReservation success", res);
let index = res.findIndex((item) => (item.showId = showId));
let deletedIdList = [];
if (index !== -1) {
deletedIdList.push(res[index]._id);
dispatch(deleteReservation(deletedIdList), {
onSuccess: (res) => {
console.log("LUNA SEND deleteReservation success", res);
},
onFailure: (err) => {
console.log("LUNA SEND deleteReservation failed", err);
},
});
}
},
onFailure: (err) => {
console.log("LUNA SEND searchReservation failed", err);
},
});
}
/* ---------------------------------------------- example

View File

@@ -269,3 +269,37 @@ export const deleteReservation = (scheduleIdList) => {
},
});
};
export const searchReservation = () => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND searchReservation");
return;
}
return new LS2Request().send({
service: "luna://com.palm.db",
method: "search",
parameters: {
query: {
from: "com.webos.service.tvReservationAgent.info:1",
orderBy: "startTime",
filter: [{ prop: "reserveType", op: "=", val: 6 }], // 6 LG Shopping 전용.
},
},
onSuccess: (res) => {
console.log("LUNA SEND searchReservation success", res);
let items = [];
res.result.forEach((item) => {
let obj = JSON.parse(item.information.information);
items.push({
_id: item._id,
showId: obj.showId,
});
});
return items;
},
onFailur: (err) => {
console.log("LUNA SEND searchReservation failed", err);
},
});
};