Merge branch 'auth-company' of adekola/talenttic-crm-app into master
This commit is contained in:
@@ -1,10 +1,26 @@
|
||||
import { Component } from "@angular/core";
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
@Component({
|
||||
selector: "app-root",
|
||||
templateUrl: "./app.component.html",
|
||||
styleUrls: ["./app.component.scss"]
|
||||
styleUrls: ["./app.component.scss"],
|
||||
})
|
||||
export class AppComponent {
|
||||
export class AppComponent implements OnInit {
|
||||
title = "black-dashboard-angular";
|
||||
companyLocalStorage: any;
|
||||
|
||||
constructor(private router: Router) {
|
||||
this.companyLocalStorage = JSON.parse(
|
||||
localStorage.getItem("companyData") || "{}"
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.companyLocalStorage) {
|
||||
this.router.navigate(["/company-information"]);
|
||||
} else {
|
||||
this.router.navigate(["/login"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
@Component({
|
||||
selector: "app-admin-layout",
|
||||
@@ -7,8 +8,9 @@ import { Component, OnInit } from "@angular/core";
|
||||
})
|
||||
export class AdminLayoutComponent implements OnInit {
|
||||
public sidebarColor: string = "red";
|
||||
companyLocalStorage: any;
|
||||
|
||||
constructor() {}
|
||||
constructor(private router: Router) {}
|
||||
changeSidebarColor(color){
|
||||
var sidebar = document.getElementsByClassName('sidebar')[0];
|
||||
var mainPanel = document.getElementsByClassName('main-panel')[0];
|
||||
@@ -31,5 +33,13 @@ export class AdminLayoutComponent implements OnInit {
|
||||
body.classList.remove('white-content');
|
||||
}
|
||||
}
|
||||
ngOnInit() {}
|
||||
ngOnInit() {
|
||||
this.companyLocalStorage = JSON.parse(localStorage.getItem('companyData') || "{}")
|
||||
|
||||
if(this.companyLocalStorage) {
|
||||
this.router.navigate(['/company-information'])
|
||||
} else {
|
||||
this.router.navigate(['/login'])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,13 +32,9 @@ export class LoginComponent implements OnInit {
|
||||
password: ["", [Validators.required, Validators.minLength(6)]],
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.companyService
|
||||
.getCompanyById(1)
|
||||
.subscribe((company) => {
|
||||
this.company = company;
|
||||
});
|
||||
this.companyService.getCompanyById(1).subscribe((company) => {
|
||||
this.company = company;
|
||||
});
|
||||
}
|
||||
|
||||
get formControls() {
|
||||
@@ -82,6 +78,8 @@ export class LoginComponent implements OnInit {
|
||||
setTimeout(() => {
|
||||
this.router.navigate(["/company-information"]);
|
||||
}, 1000);
|
||||
} else {
|
||||
this.router.navigate(["/login"]);
|
||||
}
|
||||
|
||||
this.loginForm.reset();
|
||||
|
||||
Reference in New Issue
Block a user