45 lines
785 B
JavaScript
45 lines
785 B
JavaScript
const actions = {
|
|
loginSuccess: (token) => ({
|
|
type: "LOGIN_UPDATE",
|
|
login: {
|
|
loggedIn: true,
|
|
token,
|
|
},
|
|
}),
|
|
logout: () => ({
|
|
type: "LOGOUT",
|
|
}),
|
|
userInfoUpdate: (userInfo) => ({
|
|
type: "USER_INFO_UPDATE",
|
|
userInfo,
|
|
}),
|
|
roomSave: (room) => ({
|
|
type: "ROOM_SAVE",
|
|
room,
|
|
}),
|
|
devicesUpdate: (roomId, devices, partial = false) => ({
|
|
type: "DEVICES_UPDATE",
|
|
roomId,
|
|
devices,
|
|
partial,
|
|
}),
|
|
roomDelete: (roomId) => ({
|
|
type: "ROOM_DELETE",
|
|
roomId,
|
|
}),
|
|
deviceDelete: (deviceId) => ({
|
|
type: "DEVICE_DELETE",
|
|
deviceId,
|
|
}),
|
|
};
|
|
|
|
export const appActions = {
|
|
// -1 for home view
|
|
setActiveRoom: (activeRoom = -1) => ({
|
|
type: "SET_ACTIVE_ROOM",
|
|
activeRoom,
|
|
}),
|
|
};
|
|
|
|
export default actions;
|