Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit ff82b33

Browse files
Added a reloadUser demo
1 parent 9e91c76 commit ff82b33

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

demo/app/main-page.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@
130130
<Label row="12" col="1" text="{{ userEmailOrPhone }}" class="message" textWrap="true"/>
131131

132132
<Button row="13" col="0" text="email login link" tap="{{ doLoginByEmailLink }}" class="button"/>
133-
<Button row="13" col="1" text="send email conf" tap="{{ doSendEmailVerification }}" class="button"/>
133+
<!-- <Button row="13" col="1" text="send email conf" tap="{{ doSendEmailVerification }}" class="button"/>-->
134+
<Button row="13" col="1" text="reload user" tap="{{ doReloadUser }}" class="button"/>
134135

135136
<Button row="14" col="0" text="get current user" tap="{{ doGetCurrentUser }}" class="button"/>
136137
<Button row="14" col="1" text="logout" tap="{{ doLogout }}" class="button button-user"/>

demo/app/main-view-model.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,8 @@ export class HelloWorldModel extends Observable {
11441144
}
11451145
}).then(
11461146
result => {
1147-
console.log("Google login OK: " + JSON.stringify(result));
1147+
console.log("Google login OK: " + JSON.stringify(result.additionalUserInfo));
1148+
console.log("Google login OK, photoURL: " + result.photoURL);
11481149
alert({
11491150
title: "Login OK",
11501151
message: JSON.stringify(result),
@@ -1161,6 +1162,25 @@ export class HelloWorldModel extends Observable {
11611162
);
11621163
}
11631164

1165+
public doReloadUser(): void {
1166+
firebase.reloadUser().then(
1167+
() => {
1168+
alert({
1169+
title: "User reloaded",
1170+
message: "You can use 'get current user' to inspect the reloaded data",
1171+
okButtonText: "OK"
1172+
});
1173+
},
1174+
errorMessage => {
1175+
alert({
1176+
title: "Reload error",
1177+
message: errorMessage,
1178+
okButtonText: "OK, shame"
1179+
});
1180+
}
1181+
);
1182+
}
1183+
11641184
public doResetPassword(): void {
11651185
firebase.sendPasswordResetEmail("eddyverbruggen+firebase@gmail.com").then(
11661186
() => {

0 commit comments

Comments
 (0)