mirror of
https://gitlab.com/comunic/comunicconsole
synced 2025-07-06 18:12:50 +00:00
Ready to present user settings
This commit is contained in:
@ -6,6 +6,8 @@
|
||||
|
||||
import React from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { AccountHelper, AdminAccount } from "../../helpers/AccountHelper";
|
||||
import { AsyncWidget } from "../widgets/AsyncWidget";
|
||||
|
||||
export function AccountSettingsRoute() {
|
||||
let params: any = useParams();
|
||||
@ -17,7 +19,9 @@ interface SettingsRouteProps {
|
||||
id: number;
|
||||
}
|
||||
|
||||
interface SettingsRouteState {}
|
||||
interface SettingsRouteState {
|
||||
account: AdminAccount;
|
||||
}
|
||||
|
||||
class AccountSettingsRouteInner extends React.Component<
|
||||
SettingsRouteProps,
|
||||
@ -26,10 +30,28 @@ class AccountSettingsRouteInner extends React.Component<
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
|
||||
this.state = {};
|
||||
this.load = this.load.bind(this);
|
||||
this.build = this.build.bind(this);
|
||||
}
|
||||
|
||||
async load() {
|
||||
const account = await AccountHelper.getAdminInfo(this.props.id);
|
||||
|
||||
this.setState({ account: account });
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div>"hello {this.props.id}</div>;
|
||||
return (
|
||||
<AsyncWidget
|
||||
key={this.props.id}
|
||||
errorMessage="Failed to load admin information!"
|
||||
onBuild={this.build}
|
||||
load={this.load}
|
||||
></AsyncWidget>
|
||||
);
|
||||
}
|
||||
|
||||
build() {
|
||||
return <p>{this.state.account.email}</p>;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user