update: google oauth2.0 with hd=email@forth.co.th only now functional

This commit is contained in:
Kenta420-Poom 2023-09-20 09:57:47 +07:00
parent 984707c7bf
commit 36c71eda38
31 changed files with 580 additions and 317 deletions

View file

@ -0,0 +1 @@
<!-- just call back nothing here -->

View file

@ -0,0 +1,37 @@
import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { UserService } from '../services/user.service';
@Component({
selector: 'app-callback',
standalone: true,
templateUrl: './callback.component.html',
})
export class CallbackComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private router: Router,
private userService: UserService
) {}
ngOnInit(): void {
this.route.queryParams.subscribe((params) => {
console.log(params);
if (params['email'] && params['name'] && params['picture']) {
this.userService.setAuth({
email: params['email'],
username: params['name'],
image: params['picture'],
});
}
if (params['redirect_to']) {
this.router.navigate([params['redirect_to']]);
} else {
this.router.navigate(['/']);
}
});
}
}