@thzero/library_client_firebase 0.16.8 → 0.16.9

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/boot/starter.js +1 -108
  2. package/package.json +2 -2
package/boot/starter.js CHANGED
@@ -16,7 +16,7 @@ export default (setup) => {
16
16
  const configFirebase = configExternal.firebase;
17
17
  if (!configFirebase)
18
18
  throw Error('Invalid firebase config.');
19
- const firebaseApp = initializeApp(configFirebase);
19
+ initializeApp(configFirebase);
20
20
  if (configFirebase.measurementId)
21
21
  getAnalytics();
22
22
 
@@ -28,29 +28,11 @@ export default (setup) => {
28
28
  });
29
29
 
30
30
  const firebaseAuth = getAuth();
31
- // if (firebaseAuth.currentUser) {
32
- // const timer = setInterval(async () => {
33
- // clearInterval(timer)
34
- // const auth = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_AUTH)
35
- // await auth.onAuthStateChanged(null)
36
- // }, 50)
37
- // }
38
31
  // eslint-disable-next-line
39
32
  let init = false;
40
33
  firebaseAuth.onAuthStateChanged(async function(user) {
41
- // if (user == null) {
42
- // // GlobalUtility.$navRouter.push('/auth')
43
- // return
44
- // }
45
-
46
34
  const auth = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_AUTH);
47
- // await auth.onAuthStateChanged(user)
48
- // const timer = setInterval(async () => {
49
- // clearInterval(timer)
50
- // await auth.onAuthStateChanged(user)
51
- // }, 50)
52
35
  await auth.onAuthStateChanged(user);
53
- // if (test)
54
36
  if (!init) {
55
37
  init = true;
56
38
  outsideResolve(true);
@@ -60,96 +42,7 @@ export default (setup) => {
60
42
  outsideReject();
61
43
  });
62
44
 
63
- // setInterval(async () => {
64
- // const logger = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_LOGGER)
65
- // const auth = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_AUTH)
66
- // try {
67
- // await auth.refreshToken(correlationId, auth.externalUser, true).then()
68
- // }
69
- // catch (err) {
70
- // logger.error(err)
71
- // }
72
- // }, 60 * 1000)
73
-
74
- // firebase.auth().onIdTokenChanged(async function(user) {
75
- // const logger = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_LOGGER)
76
- // try {
77
- // const auth = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_AUTH)
78
-
79
- // // const interval = 500 // 10 * 1000
80
- // // const timer = setInterval(async () => {
81
- // // await auth.onRefresh(user)
82
- // // clearInterval(timer)
83
- // // }, interval)
84
- // await auth.onRefresh(user)
85
- // }
86
- // catch (err) {
87
- // logger.error(err)
88
- // }
89
- // })
90
-
91
45
  setup();
92
- // router.beforeResolve((to, from, next) => {
93
- // const auth = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_AUTH);
94
- // const logger = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_LOGGER);
95
- // logger.debug('router.beforeResolve', to);
96
- // if (to.matched.some(record => record.meta.requiresAuth)) {
97
- // const isLoggedIn = auth.isAuthenticated;
98
- // if (!isLoggedIn) {
99
- // // GlobalUtility.$EventBus.on('auth-refresh', (user) => {
100
- // // logger.debug('auth-refresh', user)
101
- // // next()
102
- // // })
103
- // // return
104
- // GlobalUtility.$navRouter.push('/', null, () => {
105
- // // GlobalUtility.$navRouter.push('/')
106
- // // window.location.href = '/'
107
- // });
108
- // return;
109
- // }
110
-
111
- // next();
112
-
113
- // // eslint-disable-next-line no-unused-vars
114
- // // auth.isAuthenticated().then(async (data) => {
115
- // // logger.debug('router.beforeResolve.matched')
116
-
117
- // // //const isLoggedIn = GlobalUtility.$store.state.user.isLoggedIn
118
- // // const isLoggedIn = await auth.isAuthenticated()
119
- // // if (!isLoggedIn) {
120
- // // GlobalUtility.$EventBus.on('auth-refresh', (user) => {
121
- // // logger.debug('auth-refresh', user)
122
- // // next()
123
- // // })
124
- // // return
125
- // // }
126
-
127
- // // // if (GlobalUtility.$store.state.user.token) {
128
- // // // next()
129
- // // // return
130
- // // // }
131
-
132
- // // // GlobalUtility.$EventBus.on('auth-refresh', (user) => {
133
- // // // logger.debug('auth-refresh', user)
134
- // // // next()
135
- // // // })
136
-
137
- // // next()
138
- // // }).catch((e) => {
139
- // // logger.error('router.beforeResolve.error', e)
140
- // // logger.error('to', to)
141
- // // logger.error('from', from)
142
- // // if (to.name == 'auth') {
143
- // // next()
144
- // // return
145
- // // }
146
- // // next({ path: '/auth' })
147
- // // })
148
-
149
- // return;
150
- // }
151
- // next();
152
- // });
153
46
 
154
47
  return promiseAuth;
155
48
  };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@thzero/library_client_firebase",
3
- "version": "0.16.8",
3
+ "version": "0.16.9",
4
4
  "version_major": 0,
5
5
  "version_minor": 16,
6
- "version_patch": 8,
6
+ "version_patch": 9,
7
7
  "version_date": "12/06/2022",
8
8
  "author": "thZero",
9
9
  "license": "MIT",