Add client context.

This commit is contained in:
Paul
2021-06-18 20:07:26 +01:00
parent e7d1ada13d
commit aa81ebb298
12 changed files with 260 additions and 33 deletions

View File

@@ -1,6 +1,7 @@
import { State } from "..";
import { combineReducers } from "redux";
import { config, ConfigAction } from "./server_config";
import { settings, SettingsAction } from "./settings";
import { locale, LocaleAction } from "./locale";
import { auth, AuthAction } from "./auth";
@@ -12,6 +13,7 @@ import { sync, SyncAction } from "./sync";
import { experiments, ExperimentsAction } from "./experiments";
export default combineReducers({
config,
locale,
auth,
settings,
@@ -24,6 +26,7 @@ export default combineReducers({
});
export type Action =
| ConfigAction
| LocaleAction
| AuthAction
| SettingsAction

View File

@@ -0,0 +1,20 @@
import { Core } from "revolt.js/dist/api/objects";
export type ConfigAction =
| { type: undefined }
| {
type: "SET_CONFIG";
config: Core.RevoltNodeConfiguration;
};
export function config(
state = { } as Core.RevoltNodeConfiguration,
action: ConfigAction
): Core.RevoltNodeConfiguration {
switch (action.type) {
case "SET_CONFIG":
return action.config;
default:
return state;
}
}