Skip to content

Commit 919515b

Browse files
committed
chore(angular): Add redirect handlers to example app
1 parent f2e8173 commit 919515b

File tree

16 files changed

+127
-35
lines changed

16 files changed

+127
-35
lines changed

examples/angular/src/app/screens/email-link-auth-screen-w-oauth/email-link-auth-screen-w-oauth.component.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,32 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component } from "@angular/core";
17+
import { Component, inject } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import { EmailLinkAuthScreenComponent, GoogleSignInButtonComponent } from "@invertase/firebaseui-angular";
20+
import { UserCredential } from "firebase/auth";
21+
import { Router } from "@angular/router";
2022

2123
@Component({
2224
selector: "app-email-link-auth-screen-w-oauth",
2325
standalone: true,
2426
imports: [CommonModule, EmailLinkAuthScreenComponent, GoogleSignInButtonComponent],
2527
template: `
26-
<fui-email-link-auth-screen>
28+
<fui-email-link-auth-screen (emailSent)="onEmailSent()" (signIn)="onSignIn($event)">
2729
<fui-google-sign-in-button></fui-google-sign-in-button>
2830
</fui-email-link-auth-screen>
2931
`,
3032
styles: [],
3133
})
32-
export class EmailLinkAuthScreenWithOAuthComponent {}
34+
export class EmailLinkAuthScreenWithOAuthComponent {
35+
private router = inject(Router);
36+
37+
onEmailSent() {
38+
alert("email sent - please check your email");
39+
}
40+
41+
onSignIn(credential: UserCredential) {
42+
console.log("sign in", credential);
43+
this.router.navigate(["/"]);
44+
}
45+
}

examples/angular/src/app/screens/email-link-auth-screen/email-link-auth-screen.component.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,28 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component } from "@angular/core";
17+
import { Component, inject } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import { EmailLinkAuthScreenComponent } from "@invertase/firebaseui-angular";
20+
import { UserCredential } from "firebase/auth";
21+
import { Router } from "@angular/router";
2022

2123
@Component({
2224
selector: "app-email-link-auth-screen",
2325
standalone: true,
2426
imports: [CommonModule, EmailLinkAuthScreenComponent],
25-
template: ` <fui-email-link-auth-screen></fui-email-link-auth-screen> `,
27+
template: ` <fui-email-link-auth-screen (emailSent)="onEmailSent()" (signIn)="onSignIn($event)" />`,
2628
styles: [],
2729
})
28-
export class EmailLinkAuthScreenWrapperComponent {}
30+
export class EmailLinkAuthScreenWrapperComponent {
31+
private router = inject(Router);
32+
33+
onEmailSent() {
34+
alert("email sent - please check your email");
35+
}
36+
37+
onSignIn(credential: UserCredential) {
38+
console.log("sign in", credential);
39+
this.router.navigate(["/"]);
40+
}
41+
}

examples/angular/src/app/screens/forgot-password-auth-screen/forgot-password-auth-screen.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ import { ForgotPasswordAuthScreenComponent } from "@invertase/firebaseui-angular
2222
selector: "app-forgot-password-auth-screen",
2323
standalone: true,
2424
imports: [CommonModule, ForgotPasswordAuthScreenComponent],
25-
template: ` <fui-forgot-password-auth-screen></fui-forgot-password-auth-screen> `,
25+
template: ` <fui-forgot-password-auth-screen (passwordSent)="onPasswordSent()" />`,
2626
styles: [],
2727
})
28-
export class ForgotPasswordAuthScreenWrapperComponent {}
28+
export class ForgotPasswordAuthScreenWrapperComponent {
29+
onPasswordSent() {
30+
alert("password reset email sent - please check your email");
31+
}
32+
}

examples/angular/src/app/screens/oauth-screen/oauth-screen.component.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component, signal } from "@angular/core";
17+
import { Component, inject, signal } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import {
2020
OAuthScreenComponent,
@@ -25,6 +25,8 @@ import {
2525
MicrosoftSignInButtonComponent,
2626
TwitterSignInButtonComponent,
2727
} from "@invertase/firebaseui-angular";
28+
import { UserCredential } from "firebase/auth";
29+
import { Router } from "@angular/router";
2830

2931
@Component({
3032
selector: "app-oauth-screen",
@@ -40,7 +42,7 @@ import {
4042
TwitterSignInButtonComponent,
4143
],
4244
template: `
43-
<fui-oauth-screen>
45+
<fui-oauth-screen (onSignIn)="onSignIn($event)">
4446
<fui-google-sign-in-button [themed]="themed() ? 'neutral' : false" />
4547
<fui-facebook-sign-in-button [themed]="themed()" />
4648
<fui-apple-sign-in-button [themed]="themed()" />
@@ -59,4 +61,10 @@ import {
5961
})
6062
export class OAuthScreenWrapperComponent {
6163
themed = signal(false);
64+
private router = inject(Router);
65+
66+
onSignIn(credential: UserCredential) {
67+
console.log("sign in", credential);
68+
this.router.navigate(["/"]);
69+
}
6270
}

examples/angular/src/app/screens/phone-auth-screen-w-oauth/phone-auth-screen-w-oauth.component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,30 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component } from "@angular/core";
17+
import { Component, inject } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import { PhoneAuthScreenComponent, GoogleSignInButtonComponent, ContentComponent } from "@invertase/firebaseui-angular";
20+
import { UserCredential } from "firebase/auth";
21+
import { Router } from "@angular/router";
2022

2123
@Component({
2224
selector: "app-phone-auth-screen-w-oauth",
2325
standalone: true,
2426
imports: [CommonModule, PhoneAuthScreenComponent, GoogleSignInButtonComponent, ContentComponent],
2527
template: `
26-
<fui-phone-auth-screen>
28+
<fui-phone-auth-screen (signIn)="onSignIn($event)">
2729
<fui-content>
2830
<fui-google-sign-in-button></fui-google-sign-in-button>
2931
</fui-content>
3032
</fui-phone-auth-screen>
3133
`,
3234
styles: [],
3335
})
34-
export class PhoneAuthScreenWithOAuthComponent {}
36+
export class PhoneAuthScreenWithOAuthComponent {
37+
private router = inject(Router);
38+
39+
onSignIn(credential: UserCredential) {
40+
console.log("sign in", credential);
41+
this.router.navigate(["/"]);
42+
}
43+
}

examples/angular/src/app/screens/phone-auth-screen/phone-auth-screen.component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,24 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component } from "@angular/core";
17+
import { Component, inject } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import { PhoneAuthScreenComponent } from "@invertase/firebaseui-angular";
20+
import { UserCredential } from "firebase/auth";
21+
import { Router } from "@angular/router";
2022

2123
@Component({
2224
selector: "app-phone-auth-screen",
2325
standalone: true,
2426
imports: [CommonModule, PhoneAuthScreenComponent],
25-
template: ` <fui-phone-auth-screen></fui-phone-auth-screen> `,
27+
template: ` <fui-phone-auth-screen (signIn)="onSignIn($event)" />`,
2628
styles: [],
2729
})
28-
export class PhoneAuthScreenWrapperComponent {}
30+
export class PhoneAuthScreenWrapperComponent {
31+
private router = inject(Router);
32+
33+
onSignIn(credential: UserCredential) {
34+
console.log("sign in", credential);
35+
this.router.navigate(["/"]);
36+
}
37+
}

examples/angular/src/app/screens/sign-in-auth-screen-w-oauth/sign-in-auth-screen-w-oauth.component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component } from "@angular/core";
17+
import { Component, inject } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import {
2020
SignInAuthScreenComponent,
@@ -26,6 +26,8 @@ import {
2626
MicrosoftSignInButtonComponent,
2727
TwitterSignInButtonComponent,
2828
} from "@invertase/firebaseui-angular";
29+
import { UserCredential } from "firebase/auth";
30+
import { Router } from "@angular/router";
2931

3032
@Component({
3133
selector: "app-sign-in-auth-screen-w-oauth",
@@ -42,7 +44,7 @@ import {
4244
TwitterSignInButtonComponent,
4345
],
4446
template: `
45-
<fui-sign-in-auth-screen>
47+
<fui-sign-in-auth-screen (signIn)="onSignIn($event)">
4648
<fui-content>
4749
<fui-google-sign-in-button />
4850
<fui-facebook-sign-in-button />
@@ -55,4 +57,11 @@ import {
5557
`,
5658
styles: [],
5759
})
58-
export class SignInAuthScreenWithOAuthComponent {}
60+
export class SignInAuthScreenWithOAuthComponent {
61+
private router = inject(Router);
62+
63+
onSignIn(credential: UserCredential) {
64+
console.log("sign in", credential);
65+
this.router.navigate(["/"]);
66+
}
67+
}

examples/angular/src/app/screens/sign-in-auth-screen/sign-in-auth-screen.component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,24 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component } from "@angular/core";
17+
import { Component, inject } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import { SignInAuthScreenComponent } from "@invertase/firebaseui-angular";
20+
import { UserCredential } from "firebase/auth";
21+
import { Router } from "@angular/router";
2022

2123
@Component({
2224
selector: "app-sign-in-auth-screen",
2325
standalone: true,
2426
imports: [CommonModule, SignInAuthScreenComponent],
25-
template: ` <fui-sign-in-auth-screen></fui-sign-in-auth-screen> `,
27+
template: ` <fui-sign-in-auth-screen (signIn)="onSignIn($event)" />`,
2628
styles: [],
2729
})
28-
export class SignInAuthScreenWrapperComponent {}
30+
export class SignInAuthScreenWrapperComponent {
31+
private router = inject(Router);
32+
33+
onSignIn(credential: UserCredential) {
34+
console.log("sign in", credential);
35+
this.router.navigate(["/"]);
36+
}
37+
}

examples/angular/src/app/screens/sign-up-auth-screen-w-oauth/sign-up-auth-screen-w-oauth.component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component } from "@angular/core";
17+
import { Component, inject } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import {
2020
SignUpAuthScreenComponent,
@@ -26,6 +26,8 @@ import {
2626
MicrosoftSignInButtonComponent,
2727
TwitterSignInButtonComponent,
2828
} from "@invertase/firebaseui-angular";
29+
import { UserCredential } from "firebase/auth";
30+
import { Router } from "@angular/router";
2931

3032
@Component({
3133
selector: "app-sign-up-auth-screen-w-oauth",
@@ -42,7 +44,7 @@ import {
4244
TwitterSignInButtonComponent,
4345
],
4446
template: `
45-
<fui-sign-up-auth-screen>
47+
<fui-sign-up-auth-screen (signUp)="onSignUp($event)">
4648
<fui-content>
4749
<fui-google-sign-in-button />
4850
<fui-facebook-sign-in-button />
@@ -55,4 +57,11 @@ import {
5557
`,
5658
styles: [],
5759
})
58-
export class SignUpAuthScreenWithOAuthComponent {}
60+
export class SignUpAuthScreenWithOAuthComponent {
61+
private router = inject(Router);
62+
63+
onSignUp(credential: UserCredential) {
64+
console.log("sign up", credential);
65+
this.router.navigate(["/"]);
66+
}
67+
}

examples/angular/src/app/screens/sign-up-auth-screen/sign-up-auth-screen.component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,24 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component } from "@angular/core";
17+
import { Component, inject } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import { SignUpAuthScreenComponent } from "@invertase/firebaseui-angular";
20+
import { Router } from "@angular/router";
21+
import { UserCredential } from "firebase/auth";
2022

2123
@Component({
2224
selector: "app-sign-up-auth-screen",
2325
standalone: true,
2426
imports: [CommonModule, SignUpAuthScreenComponent],
25-
template: ` <fui-sign-up-auth-screen></fui-sign-up-auth-screen> `,
27+
template: ` <fui-sign-up-auth-screen (signUp)="onSignUp($event)" />`,
2628
styles: [],
2729
})
28-
export class SignUpAuthScreenWrapperComponent {}
30+
export class SignUpAuthScreenWrapperComponent {
31+
private router = inject(Router);
32+
33+
onSignUp(credential: UserCredential) {
34+
console.log("sign up", credential);
35+
this.router.navigate(["/"]);
36+
}
37+
}

0 commit comments

Comments
 (0)