From eb80b013480f0e620d35d12d81ab0befab5d580d Mon Sep 17 00:00:00 2001 From: "hyunwoo93.cha" Date: Thu, 27 Jun 2024 23:23:22 +0900 Subject: [PATCH] luna command alarm example --- .../src/actions/mainActions.js | 54 ++++++++++++++++++- com.twin.app.shoptime/src/lunaSend/common.js | 2 +- .../FeaturedBrandsPanel.jsx | 21 +++++++- 3 files changed, 74 insertions(+), 3 deletions(-) diff --git a/com.twin.app.shoptime/src/actions/mainActions.js b/com.twin.app.shoptime/src/actions/mainActions.js index 8011ad25..11c2755c 100644 --- a/com.twin.app.shoptime/src/actions/mainActions.js +++ b/com.twin.app.shoptime/src/actions/mainActions.js @@ -1,9 +1,10 @@ import { URLS } from "../api/apiConfig"; import { TAxios } from "../api/TAxios"; +import { deleteReservation } from "../lunaSend"; import { CATEGORY_DATA_MAX_RESULTS_LIMIT } from "../utils/Config"; import * as HelperMethods from "../utils/helperMethods"; import { types } from "./actionTypes"; -import { changeAppStatus } from "./commonActions"; +import { addReservation, changeAppStatus } from "./commonActions"; export const getMainLiveShow = (props) => (dispatch, getState) => { const onSuccess = (response) => { @@ -30,12 +31,63 @@ export const getMainLiveShow = (props) => (dispatch, getState) => { onFail ); }; + // Live 알람 설정/해제 IF-LGSP-012 export const setMainLiveUpcomingAlarm = (props) => (dispatch, getState) => { const { alamDispFlag, endDt, patnrId, showId, strtDt } = props; const onSuccess = (response) => { console.log("@@ setMainLiveUpcomingAlarm onSuccess", response.data); + + /* ---------------------------------------------- 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) => { diff --git a/com.twin.app.shoptime/src/lunaSend/common.js b/com.twin.app.shoptime/src/lunaSend/common.js index 135c5e03..eb929b4f 100644 --- a/com.twin.app.shoptime/src/lunaSend/common.js +++ b/com.twin.app.shoptime/src/lunaSend/common.js @@ -206,11 +206,11 @@ export const addReservation = (data) => { parameters: { scheduleType: "LGShopping", startTime: { + year: data.startTime.year, month: data.startTime.month, day: data.startTime.day, hour: data.startTime.hour, minute: data.startTime.minute, - year: data.startTime.year, second: data.startTime.second, }, callback: { diff --git a/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBrandsPanel.jsx b/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBrandsPanel.jsx index 654bdabd..f56dcdc3 100644 --- a/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBrandsPanel.jsx +++ b/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBrandsPanel.jsx @@ -19,7 +19,11 @@ import { getBrandShowroom, getBrandTSVInfo, } from "../../actions/brandActions"; -import { changeAppStatus, setHidePopup } from "../../actions/commonActions"; +import { + changeAppStatus, + deleteReservation, + setHidePopup, +} from "../../actions/commonActions"; import { setMainLiveUpcomingAlarm } from "../../actions/mainActions"; import { deleteMyUpcomingAlertShow, @@ -595,6 +599,21 @@ 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(setMainLiveUpcomingAlarm(upcomingAlarmInfo)); dispatch(deleteMyUpcomingAlertShow({ showList: deletedAlertShows }));