3 changed files with 39 additions and 5 deletions
@ -1,13 +1,37 @@ |
|||
import { Component } from '@angular/core'; |
|||
import { RouterOutlet } from '@angular/router'; |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { RouterOutlet, Router } from '@angular/router'; |
|||
import { CommonModule } from '@angular/common'; |
|||
|
|||
import { AuthService } from './auth.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-root', |
|||
standalone: true, |
|||
imports: [RouterOutlet], |
|||
imports: [ |
|||
RouterOutlet, |
|||
CommonModule |
|||
], |
|||
templateUrl: './app.component.html', |
|||
styleUrl: './app.component.css' |
|||
}) |
|||
export class AppComponent { |
|||
export class AppComponent implements OnInit { |
|||
title = 'jedi-archive-frontend'; |
|||
isAuthenticated = false; |
|||
|
|||
constructor(private authService: AuthService, private router: Router) {} |
|||
|
|||
ngOnInit(): void { |
|||
this.isAuthenticated = !!localStorage.getItem('token'); |
|||
} |
|||
|
|||
createSheet() { |
|||
this.authService.createSheet('My New Sheet').subscribe( |
|||
res => { |
|||
console.log('Sheet created with ID:', res.sheetId); |
|||
alert('Sheet created with ID: ' + res.sheetId); |
|||
}, |
|||
err => console.error(err) |
|||
); |
|||
} |
|||
|
|||
} |
|||
|
|||
Loading…
Reference in new issue