UNPKG

@open-tender/cloud

Version:

A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.

30 lines (29 loc) 1.27 kB
"use strict"; var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.pushNotificationsReducer = exports.selectFcmToken = exports.selectPushNotificationOrderId = exports.setFcmToken = exports.setPushNotificationsOrderId = void 0; const toolkit_1 = require("@reduxjs/toolkit"); const initialState = { orderId: null, fcmToken: null }; const pushNotificationsSlice = (0, toolkit_1.createSlice)({ name: 'pushNotifications', initialState: initialState, reducers: { setPushNotificationsOrderId(state, action) { const { orderId } = action.payload; state.orderId = orderId; }, setFcmToken(state, action) { const { fcmToken } = action.payload; state.fcmToken = fcmToken; } } }); _a = pushNotificationsSlice.actions, exports.setPushNotificationsOrderId = _a.setPushNotificationsOrderId, exports.setFcmToken = _a.setFcmToken; const selectPushNotificationOrderId = (state) => state.pushNotifications.orderId; exports.selectPushNotificationOrderId = selectPushNotificationOrderId; const selectFcmToken = (state) => state.pushNotifications.fcmToken; exports.selectFcmToken = selectFcmToken; exports.pushNotificationsReducer = pushNotificationsSlice.reducer;