You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.3 KiB
56 lines
1.3 KiB
3 years ago
|
import {
|
||
|
badgeUpdateAll,
|
||
|
bootstrap,
|
||
|
movieDeleteItems,
|
||
|
movieUpdateList,
|
||
|
seriesDeleteItems,
|
||
|
seriesUpdateList,
|
||
|
siteUpdateOffline,
|
||
|
systemUpdateLanguagesAll,
|
||
|
systemUpdateSettings,
|
||
|
} from "../@redux/actions";
|
||
|
import reduxStore from "../@redux/store";
|
||
|
|
||
|
function bindToReduxStore(fn: (ids?: number[]) => any): SocketIO.ActionFn {
|
||
|
return (ids?: number[]) => reduxStore.dispatch(fn(ids));
|
||
|
}
|
||
|
|
||
|
export function createDefaultReducer(): SocketIO.Reducer[] {
|
||
|
return [
|
||
|
{
|
||
|
key: "connect",
|
||
|
any: () => reduxStore.dispatch(siteUpdateOffline(false)),
|
||
|
},
|
||
|
{
|
||
|
key: "connect",
|
||
|
any: () => reduxStore.dispatch<any>(bootstrap()),
|
||
|
},
|
||
|
{
|
||
|
key: "disconnect",
|
||
|
any: () => reduxStore.dispatch(siteUpdateOffline(true)),
|
||
|
},
|
||
|
{
|
||
|
key: "series",
|
||
|
update: bindToReduxStore(seriesUpdateList),
|
||
|
delete: bindToReduxStore(seriesDeleteItems),
|
||
|
},
|
||
|
{
|
||
|
key: "movie",
|
||
|
update: bindToReduxStore(movieUpdateList),
|
||
|
delete: bindToReduxStore(movieDeleteItems),
|
||
|
},
|
||
|
{
|
||
|
key: "settings",
|
||
|
any: bindToReduxStore(systemUpdateSettings),
|
||
|
},
|
||
|
{
|
||
|
key: "languages",
|
||
|
any: bindToReduxStore(systemUpdateLanguagesAll),
|
||
|
},
|
||
|
{
|
||
|
key: "badges",
|
||
|
any: bindToReduxStore(badgeUpdateAll),
|
||
|
},
|
||
|
];
|
||
|
}
|