Add Redux and reducers.

Load i18n files and add dayjs.
This commit is contained in:
Paul
2021-06-18 17:57:08 +01:00
parent 0cba2b362d
commit 27eeb3acd2
25 changed files with 1506 additions and 53 deletions

View File

@@ -0,0 +1,47 @@
import { combineReducers } from "redux";
import { settings, SettingsAction } from "./settings";
import { locale, LocaleAction } from "./locale";
import { auth, AuthAction } from "./auth";
import { unreads, UnreadsAction } from "./unreads";
import { queue, QueueAction } from "./queue";
import { typing, TypingAction } from "./typing";
import { drafts, DraftAction } from "./drafts";
import { sync, SyncAction } from "./sync";
import { experiments, ExperimentsAction } from "./experiments";
export default combineReducers({
locale,
auth,
settings,
unreads,
queue,
typing,
drafts,
sync,
experiments
});
export type Action =
| LocaleAction
| AuthAction
| SettingsAction
| UnreadsAction
| QueueAction
| TypingAction
| DraftAction
| SyncAction
| ExperimentsAction
| { type: "__INIT"; state: any };
export type WithDispatcher = { dispatcher: (action: Action) => void };
export function filter(obj: any, keys: string[]) {
const newObj: any = {};
for (const key of keys) {
const v = obj[key];
if (v) newObj[key] = v;
}
return newObj;
}