Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e6d96432a | ||
|
|
c2ecfd9dee | ||
|
|
ba0f313770 |
@@ -1,10 +1,26 @@
|
|||||||
import { Component } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-root",
|
selector: "app-root",
|
||||||
templateUrl: "./app.component.html",
|
templateUrl: "./app.component.html",
|
||||||
styleUrls: ["./app.component.scss"]
|
styleUrls: ["./app.component.scss"],
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent implements OnInit {
|
||||||
title = "black-dashboard-angular";
|
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 { Component, OnInit } from "@angular/core";
|
||||||
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-admin-layout",
|
selector: "app-admin-layout",
|
||||||
@@ -7,8 +8,9 @@ import { Component, OnInit } from "@angular/core";
|
|||||||
})
|
})
|
||||||
export class AdminLayoutComponent implements OnInit {
|
export class AdminLayoutComponent implements OnInit {
|
||||||
public sidebarColor: string = "red";
|
public sidebarColor: string = "red";
|
||||||
|
companyLocalStorage: any;
|
||||||
|
|
||||||
constructor() {}
|
constructor(private router: Router) {}
|
||||||
changeSidebarColor(color){
|
changeSidebarColor(color){
|
||||||
var sidebar = document.getElementsByClassName('sidebar')[0];
|
var sidebar = document.getElementsByClassName('sidebar')[0];
|
||||||
var mainPanel = document.getElementsByClassName('main-panel')[0];
|
var mainPanel = document.getElementsByClassName('main-panel')[0];
|
||||||
@@ -31,5 +33,13 @@ export class AdminLayoutComponent implements OnInit {
|
|||||||
body.classList.remove('white-content');
|
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,11 +32,7 @@ export class LoginComponent implements OnInit {
|
|||||||
password: ["", [Validators.required, Validators.minLength(6)]],
|
password: ["", [Validators.required, Validators.minLength(6)]],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.companyService.getCompanyById(1).subscribe((company) => {
|
||||||
|
|
||||||
this.companyService
|
|
||||||
.getCompanyById(1)
|
|
||||||
.subscribe((company) => {
|
|
||||||
this.company = company;
|
this.company = company;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -82,6 +78,8 @@ export class LoginComponent implements OnInit {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.router.navigate(["/company-information"]);
|
this.router.navigate(["/company-information"]);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
} else {
|
||||||
|
this.router.navigate(["/login"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loginForm.reset();
|
this.loginForm.reset();
|
||||||
|
|||||||
Reference in New Issue
Block a user