Fixed some todos and added the start of the dashboard
This commit is contained in:
@@ -1,7 +1,40 @@
|
||||
import React from 'react';
|
||||
import DashboardView from '../../Views/DashboardView'
|
||||
|
||||
export default class Dashboard extends React.Component<{
|
||||
history: any
|
||||
}, {
|
||||
dto: any
|
||||
}> {
|
||||
state!: {
|
||||
dto: {
|
||||
API_Link: string | null;
|
||||
API_Token: string | null;
|
||||
};
|
||||
};
|
||||
props: any;
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
if (props.location.state.dto !== undefined) {
|
||||
// If the state exists being routed from /, fill in Dashboard State.
|
||||
this.state = { dto: props.location.state.dto };
|
||||
} else if (localStorage.getItem("APILink") !== null &&
|
||||
localStorage.getItem("AccessToken") !== null) {
|
||||
// Check if localStorage has valid items, if this is the case, we can use those.
|
||||
// Resolve issue with cold navigation to /dashboard.
|
||||
this.state = {
|
||||
dto: {
|
||||
API_Link: localStorage.getItem("APILink"),
|
||||
API_Token: localStorage.getItem("AccessToken")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Route back to / if neither is the case.
|
||||
this.props.history.push('/');
|
||||
}
|
||||
}
|
||||
|
||||
export default class Dashboard extends React.Component {
|
||||
render () {
|
||||
return (<h1> This is the dashboard, fuck yeah </h1>)
|
||||
return (<DashboardView />)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user