import legacy frontend & fix dependency issues
This commit is contained in:
@@ -1,11 +1,42 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { JsonPipe } from '@angular/common';
|
||||
import { Component, effect, inject, signal } from '@angular/core';
|
||||
import * as api from '../../generated-api/api';
|
||||
import { Authentication } from '../../services/authentication';
|
||||
|
||||
@Component({
|
||||
selector: 'app-test',
|
||||
imports: [],
|
||||
imports: [JsonPipe],
|
||||
templateUrl: './test.html',
|
||||
styleUrl: './test.scss',
|
||||
})
|
||||
export class Test {
|
||||
protected auth = inject(Authentication);
|
||||
|
||||
protected apiStatus = signal<string>("Waiting");
|
||||
protected authTest = signal<string>("Waiting");
|
||||
|
||||
public constructor(){
|
||||
effect(()=>{
|
||||
const loggedIn=this.auth.loggedIn();
|
||||
if(!loggedIn){
|
||||
this.apiStatus.set("N/A - not logged in");
|
||||
this.authTest.set("N/A - not logged in");
|
||||
return;
|
||||
}
|
||||
|
||||
this.apiStatus.set("Waiting for API");
|
||||
this.authTest.set("Waiting for API");
|
||||
api.getOk().then((status) => {
|
||||
this.apiStatus.set("Ok");
|
||||
}).catch((e) => {
|
||||
this.apiStatus.set("Error");
|
||||
});
|
||||
api.getAuth().then((response) => {
|
||||
this.authTest.set("Ok");
|
||||
}).catch((e) => {
|
||||
this.authTest.set(e);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user