update move login button to shared component
This commit is contained in:
parent
930911d7a9
commit
1ff1e6a90c
9 changed files with 196 additions and 48 deletions
27
client/src/app/shared/googleButton/googleButton.component.ts
Normal file
27
client/src/app/shared/googleButton/googleButton.component.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-google-button',
|
||||
template: `
|
||||
<button
|
||||
class="bg-white px-4 py-2 border flex gap-2 border-slate-200 rounded-lg text-slate-700 hover:border-slate-400 hover:text-slate-900 hover:shadow transition duration-150"
|
||||
(click)="loginWithGoogle()"
|
||||
>
|
||||
<img
|
||||
class="w-6 h-6"
|
||||
src="assets/google-color.svg"
|
||||
alt="google logo"
|
||||
loading="lazy"
|
||||
/>
|
||||
<span>Login with @foth.co.th Google account</span>
|
||||
</button>
|
||||
`,
|
||||
standalone: true,
|
||||
})
|
||||
export class GoogleButtonComponent {
|
||||
loginWithGoogle(): void {
|
||||
// redirect to google login in server
|
||||
window.location.href = environment.api + '/auth/google';
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue