@edgedev/firebase 1.5.9 → 1.5.11

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.
Files changed (2) hide show
  1. package/edgeFirebase.ts +10 -22
  2. package/package.json +1 -1
package/edgeFirebase.ts CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  } from "firebase/firestore";
26
26
 
27
27
  import {
28
- getAuth,
28
+ initializeAuth,
29
29
  setPersistence,
30
30
  browserSessionPersistence,
31
31
  browserLocalPersistence,
@@ -169,7 +169,7 @@ export const EdgeFirebase = class {
169
169
  ) {
170
170
  this.firebaseConfig = firebaseConfig;
171
171
  this.app = initializeApp(this.firebaseConfig);
172
- this.auth = getAuth(this.app);
172
+ this.auth = initializeAuth(this.app);
173
173
  this.db = getFirestore(this.app);
174
174
  this.setOnAuthStateChanged();
175
175
  }
@@ -274,6 +274,7 @@ export const EdgeFirebase = class {
274
274
  this.user.uid = null;
275
275
  this.user.loggedIn = false;
276
276
  this.user.logInError = false;
277
+ this.user.logInErrorMessage = "";
277
278
  }
278
279
  });
279
280
  };
@@ -688,25 +689,20 @@ export const EdgeFirebase = class {
688
689
 
689
690
  // Composable to login and set persistence
690
691
  public logIn = (credentials: Credentials, isPersistant = false): void => {
691
- this.user.logInErrorMessage = "Initial Click"
692
- try {
693
- this.logOut();
694
- this.user.logInErrorMessage = "After Logout"
695
- let persistence: Persistence = browserSessionPersistence;
696
- if (isPersistant) {
697
- persistence = browserLocalPersistence;
698
- }
699
- setPersistence(this.auth, persistence)
692
+ this.logOut();
693
+ let persistence: Persistence = browserSessionPersistence;
694
+ if (isPersistant) {
695
+ persistence = browserLocalPersistence;
696
+ }
697
+ setPersistence(this.auth, persistence)
700
698
  .then(() => {
701
- this.user.logInErrorMessage = "After Persistence"
702
699
  signInWithEmailAndPassword(
703
700
  this.auth,
704
701
  credentials.email,
705
702
  credentials.password
706
703
  )
707
704
  .then(() => {
708
- this.user.logInError = false;
709
- this.user.logInErrorMessage = "Login Sent to Firebase"
705
+ // do nothing
710
706
  })
711
707
  .catch((error) => {
712
708
  this.user.email = "";
@@ -725,14 +721,6 @@ export const EdgeFirebase = class {
725
721
  this.user.logInError = true;
726
722
  this.user.logInErrorMessage = error.code + ": " + error.message;
727
723
  });
728
- } catch (error) {
729
- this.user.email = "";
730
- this.user.uid = null;
731
-
732
- this.user.loggedIn = false;
733
- this.user.logInError = true;
734
- this.user.logInErrorMessage = JSON.stringify(error);
735
- }
736
724
  };
737
725
 
738
726
  // Keeping this for reference on how to Type a Ref.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgedev/firebase",
3
- "version": "1.5.9",
3
+ "version": "1.5.11",
4
4
  "description": "Vue 3 / Nuxt 3 Plugin or Nuxt 3 global composable for firebase authentication and firestore.",
5
5
  "main": "index.ts",
6
6
  "scripts": {