Moved to Angular 20
Moved to Tailwind 4 Moved to Python 3.13 Enabled arm64/v8 Builds
This commit is contained in:
@ -2,7 +2,6 @@ import { inject } from '@angular/core';
|
||||
import { CanActivateFn, Router } from '@angular/router';
|
||||
|
||||
import { ToasterService } from '../core/toaster.service';
|
||||
|
||||
import { AuthService } from './auth.service';
|
||||
|
||||
export const authGuard: CanActivateFn = (route, state) => {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@ -15,15 +15,15 @@ const JWT_USER = 'JWT_USER';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AuthService {
|
||||
private http = inject(HttpClient);
|
||||
private cs = inject(CookieService);
|
||||
|
||||
public currentUser: Observable<User | null>;
|
||||
public device: Device;
|
||||
private currentUserSubject: BehaviorSubject<User | null> = new BehaviorSubject<User | null>(null);
|
||||
public isRefreshing = false;
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private cs: CookieService,
|
||||
) {
|
||||
constructor() {
|
||||
this.checkStorage();
|
||||
this.currentUser = this.currentUserSubject.asObservable();
|
||||
const deviceId = this.cs.getCookie('device_id');
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild, inject } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
@ -27,6 +27,13 @@ import { AuthService } from '../auth.service';
|
||||
],
|
||||
})
|
||||
export class LoginComponent implements OnInit, AfterViewInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private auth = inject(AuthService);
|
||||
private router = inject(Router);
|
||||
private toaster = inject(ToasterService);
|
||||
private cs = inject(CookieService);
|
||||
private cd = inject(ChangeDetectorRef);
|
||||
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup<{
|
||||
username: FormControl<string>;
|
||||
@ -38,14 +45,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
deviceName: string;
|
||||
private returnUrl: string;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private auth: AuthService,
|
||||
private router: Router,
|
||||
private toaster: ToasterService,
|
||||
private cs: CookieService,
|
||||
private cd: ChangeDetectorRef,
|
||||
) {
|
||||
constructor() {
|
||||
this.hide = true;
|
||||
this.unregisteredDevice = false;
|
||||
this.deviceName = '';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
|
||||
import { AuthService } from '../auth.service';
|
||||
|
||||
@ -8,7 +8,7 @@ import { AuthService } from '../auth.service';
|
||||
standalone: true,
|
||||
})
|
||||
export class LogoutComponent implements OnInit {
|
||||
constructor(private auth: AuthService) {}
|
||||
private auth = inject(AuthService);
|
||||
|
||||
ngOnInit() {
|
||||
this.auth.logout();
|
||||
|
||||
Reference in New Issue
Block a user