|
|
@@ -136,8 +136,25 @@ class Home extends Component<PropsType, StateType> {
|
|
|
.catch(console.log);
|
|
|
};
|
|
|
|
|
|
+ checkIfCanCreateProject = () => {
|
|
|
+ api
|
|
|
+ .getCanCreateProject("<token>", {}, {})
|
|
|
+ .then((res) => {
|
|
|
+ if (res.status === 403) {
|
|
|
+ this.context.setCanCreateProject(false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.context.setCanCreateProject(true);
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.context.setCanCreateProject(false);
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
componentDidMount() {
|
|
|
this.checkOnboarding();
|
|
|
+ this.checkIfCanCreateProject();
|
|
|
let { match } = this.props;
|
|
|
|
|
|
let { user } = this.context;
|
|
|
@@ -176,6 +193,10 @@ class Home extends Component<PropsType, StateType> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ componentWillUnmount(): void {
|
|
|
+ this.context.setCanCreateProject(false);
|
|
|
+ }
|
|
|
+
|
|
|
async checkIfProjectHasBilling(projectId: number) {
|
|
|
if (!projectId) {
|
|
|
return false;
|