feat(state_mgr): support set clients
This commit is contained in:
parent
9b67a85d97
commit
dc3783a091
1 changed files with 12 additions and 1 deletions
|
@ -6,18 +6,29 @@ import { ICoreState, newState } from "./core_state";
|
||||||
import { RootFrame } from "./root_frame";
|
import { RootFrame } from "./root_frame";
|
||||||
import { FilesClient } from "../client/files";
|
import { FilesClient } from "../client/files";
|
||||||
import { UsersClient } from "../client/users";
|
import { UsersClient } from "../client/users";
|
||||||
// import { Updater as LoginPaneUpdater } from "./pane_login";
|
import { IUsersClient, IFilesClient } from "../client";
|
||||||
|
|
||||||
export interface Props {}
|
export interface Props {}
|
||||||
export interface State extends ICoreState {}
|
export interface State extends ICoreState {}
|
||||||
|
|
||||||
export class StateMgr extends React.Component<Props, State, {}> {
|
export class StateMgr extends React.Component<Props, State, {}> {
|
||||||
|
private usersClient: IUsersClient = new UsersClient("");
|
||||||
|
private filesClient: IFilesClient = new FilesClient("");
|
||||||
|
|
||||||
constructor(p: Props) {
|
constructor(p: Props) {
|
||||||
super(p);
|
super(p);
|
||||||
this.state = newState();
|
this.state = newState();
|
||||||
this.initUpdater(this.state);
|
this.initUpdater(this.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setUsersClient = (client: IUsersClient) => {
|
||||||
|
this.usersClient = client;
|
||||||
|
};
|
||||||
|
|
||||||
|
setFilesClient = (client: IFilesClient) => {
|
||||||
|
this.filesClient = client;
|
||||||
|
};
|
||||||
|
|
||||||
initUpdater = (state: ICoreState) => {
|
initUpdater = (state: ICoreState) => {
|
||||||
updater().init(state);
|
updater().init(state);
|
||||||
updater().setClients(new UsersClient(""), new FilesClient(""));
|
updater().setClients(new UsersClient(""), new FilesClient(""));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue