@edgedev/firebase 1.5.5 → 1.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/edgeFirebase.ts +22 -8
- package/package.json +1 -1
package/edgeFirebase.ts
CHANGED
|
@@ -689,12 +689,13 @@ export const EdgeFirebase = class {
|
|
|
689
689
|
|
|
690
690
|
// Composable to login and set persistence
|
|
691
691
|
public logIn = (credentials: Credentials, isPersistant = false): void => {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
692
|
+
try {
|
|
693
|
+
this.logOut();
|
|
694
|
+
let persistence: Persistence = browserSessionPersistence;
|
|
695
|
+
if (isPersistant) {
|
|
696
|
+
persistence = browserLocalPersistence;
|
|
697
|
+
}
|
|
698
|
+
setPersistence(this.auth, persistence)
|
|
698
699
|
.then(() => {
|
|
699
700
|
signInWithEmailAndPassword(
|
|
700
701
|
this.auth,
|
|
@@ -702,7 +703,12 @@ export const EdgeFirebase = class {
|
|
|
702
703
|
credentials.password
|
|
703
704
|
)
|
|
704
705
|
.then(() => {
|
|
705
|
-
|
|
706
|
+
this.user.email = "";
|
|
707
|
+
this.user.uid = null;
|
|
708
|
+
|
|
709
|
+
this.user.loggedIn = false;
|
|
710
|
+
this.user.logInError = false;
|
|
711
|
+
this.user.logInErrorMessage = "Login Sent to Firebase"
|
|
706
712
|
})
|
|
707
713
|
.catch((error) => {
|
|
708
714
|
this.user.email = "";
|
|
@@ -721,6 +727,14 @@ export const EdgeFirebase = class {
|
|
|
721
727
|
this.user.logInError = true;
|
|
722
728
|
this.user.logInErrorMessage = error.code + ": " + error.message;
|
|
723
729
|
});
|
|
730
|
+
} catch (error) {
|
|
731
|
+
this.user.email = "";
|
|
732
|
+
this.user.uid = null;
|
|
733
|
+
|
|
734
|
+
this.user.loggedIn = false;
|
|
735
|
+
this.user.logInError = true;
|
|
736
|
+
this.user.logInErrorMessage = JSON.stringify(error);
|
|
737
|
+
}
|
|
724
738
|
};
|
|
725
739
|
|
|
726
740
|
// Keeping this for reference on how to Type a Ref.
|
|
@@ -1130,12 +1144,12 @@ export const EdgeFirebase = class {
|
|
|
1130
1144
|
const keys = Object.keys(this.usersByCollections).filter((key) => key.startsWith('ROLES|') || key.startsWith('SPECIALPERMISSIONS|'));
|
|
1131
1145
|
keys.forEach((key) => {
|
|
1132
1146
|
this.stopSnapshot(key);
|
|
1147
|
+
delete this.usersByCollections[key];
|
|
1133
1148
|
});
|
|
1134
1149
|
}
|
|
1135
1150
|
|
|
1136
1151
|
public startUsersSnapshot = (collectionPath = ''): void => {
|
|
1137
1152
|
this.stopUsersSnapshot();
|
|
1138
|
-
this.usersByCollections = {};
|
|
1139
1153
|
for (const collectionPathCheck of this.user.canAssignCollectionPaths) {
|
|
1140
1154
|
|
|
1141
1155
|
if (collectionPathCheck.startsWith(collectionPath.replaceAll('/', '-'))) {
|