updated demo to use the new login redirect

This commit is contained in:
2026-06-11 20:59:02 +02:00
parent b6e9ddbb0e
commit 09c75c3f6b
8 changed files with 224 additions and 286 deletions

33
src/app/login.ts Normal file
View File

@@ -0,0 +1,33 @@
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-login',
imports: [],
template: `
<div class="flex flex-col items-center justify-center h-screen w-screen opacity-20">
<div class="animate-fadein duration-1000 animate-infinite animate-alternate text-4xl">Signing in...</div>
</div>
`,
styles: [`
@tailwind base;
@tailwind components;
@tailwind utilities;
`],
})
export class Login {
constructor(
private readonly route: ActivatedRoute
) {
this.route.queryParams.subscribe((params) => {
const token = params['authToken'];
if(token){
const redirectTo = decodeURIComponent(atob(params['redirectTo']));
localStorage.setItem('api-key', token);
//remove the authToken from the url but keep the redirectTo
window.history.replaceState({}, '', redirectTo);
window.location.href = redirectTo;
}
});
}
}