Просмотр исходного кода

Merge branch 'beta.3.integration-frontend' of https://github.com/porter-dev/porter into beta.3.integration-frontend

mergin
Alexander Belanger 5 лет назад
Родитель
Сommit
508cc27d98

+ 3 - 1
dashboard/src/main/Login.tsx

@@ -55,7 +55,9 @@ export default class Login extends Component<PropsType, StateType> {
         password: password
       }, {}, (err: any, res: any) => {
         // TODO: case and set credential error
-        console.log(res.data);
+        if (err) {
+          this.context.setCurrentError('Incorrect email or password.')
+        }
         setUser(res?.data?.id, res?.data?.email)
         err ? console.log(err) : authenticate();
       });

+ 17 - 14
dashboard/src/main/home/Home.tsx

@@ -53,21 +53,24 @@ export default class Home extends Component<PropsType, StateType> {
   }
 
   initializeView = () => {
-    let { currentCluster } = this.context;
     let { currentProject } = this.props;
-    // Check if current project is provisioning
-    api.getInfra('<token>', {}, { project_id: currentProject.id }, (err: any, res: any) => {
-      if (err) {
-        console.log(err);
-        return;
-      }
-      console.log(currentCluster);
-      if (!currentCluster && !includesCompletedInfraSet(res.data)) {
-        this.setState({ currentView: 'provisioner', sidebarReady: true, });
-      } else {
-        this.setState({ currentView: 'dashboard', sidebarReady: true });
-      }
-    });
+    
+    if (currentProject) {
+      let { currentCluster } = this.context;
+      // Check if current project is provisioning
+      api.getInfra('<token>', {}, { project_id: currentProject.id }, (err: any, res: any) => {
+        if (err) {
+          console.log(err);
+          return;
+        }
+        console.log(currentCluster);
+        if (!currentCluster && !includesCompletedInfraSet(res.data)) {
+          this.setState({ currentView: 'provisioner', sidebarReady: true, });
+        } else {
+          this.setState({ currentView: 'dashboard', sidebarReady: true });
+        }
+      });
+    }
   }
 
   getProjects = () => {

+ 0 - 1
dashboard/src/main/home/provisioner/DOFormSection.tsx

@@ -116,7 +116,6 @@ export default class DOFormSection extends Component<PropsType, StateType> {
       window.location.href = `/api/oauth/projects/${currentProject.id}/digitalocean`;
     } else {
       this.createProject(() => {
-        console.log('redirecting...')
         window.location.href = `/api/oauth/projects/${currentProject.id}/digitalocean`;
       });
     }

+ 0 - 2
dashboard/src/shared/baseApi.tsx

@@ -56,8 +56,6 @@ export const baseApi = <T extends {}, S = {}>(requestType: string, endpoint: ((p
         }
       })
       .then(res => {
-        console.log('from axio')
-        console.log(res.data);
         callback && callback(null, res);
       })
       .catch(err => {