updated demo to use the new login redirect
This commit is contained in:
33
src/app/login.ts
Normal file
33
src/app/login.ts
Normal 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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user