34 lines
953 B
TypeScript
34 lines
953 B
TypeScript
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;
|
|
}
|
|
});
|
|
}
|
|
}
|