Requre auth for pages

This commit is contained in:
2025-08-10 21:03:28 -07:00
parent 9630147a79
commit 882e1220d1
4 changed files with 17 additions and 0 deletions
@@ -28,6 +28,11 @@ export class CompanyComponent {
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) { constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
this.title.setTitle("Companies | BoredCareers"); this.title.setTitle("Companies | BoredCareers");
if (!auth.isLoggedIn){
router.navigate(["/"]);
}
http.get<Employee[]>("api/employee/").subscribe({ http.get<Employee[]>("api/employee/").subscribe({
next: data => { next: data => {
this.Employers = data; this.Employers = data;
@@ -25,6 +25,10 @@ export class CompanyEditorComponent {
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) { constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
this.title.setTitle("Company - Editor | BoredCareers"); this.title.setTitle("Company - Editor | BoredCareers");
if (!auth.isLoggedIn){
router.navigate(["/"]);
}
// Query param CompanyID -> Edit // Query param CompanyID -> Edit
// Query param null -> New // Query param null -> New
}; };
@@ -27,6 +27,10 @@ export class JobEditorComponent {
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) { constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
this.title.setTitle("Jobs - Editor | BoredCareers"); this.title.setTitle("Jobs - Editor | BoredCareers");
if (!auth.isLoggedIn){
router.navigate(["/"]);
}
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
const CompanyID = params['CompanyID'] ? +params['CompanyID'] : null; const CompanyID = params['CompanyID'] ? +params['CompanyID'] : null;
const JobID = params['JobID'] ? +params['JobID'] : null; const JobID = params['JobID'] ? +params['JobID'] : null;
@@ -20,6 +20,10 @@ export class ResumesComponent {
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) { constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
this.title.setTitle("Resumes | BoredCareers"); this.title.setTitle("Resumes | BoredCareers");
if (!auth.isLoggedIn){
router.navigate(["/"]);
}
this.http.get<Resume[]>("api/resume").subscribe({ this.http.get<Resume[]>("api/resume").subscribe({
next: data => { next: data => {
this.ResumePage = data; this.ResumePage = data;