esoftplay-event 0.0.2-a → 0.0.2-b

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.
@@ -117,7 +117,7 @@ export default function useFirebaseSocket() {
117
117
  return
118
118
  }
119
119
 
120
- if (userIdKeyReplacer.get()?.priority == 1) {
120
+ if (userIdKeyReplacer.get()?.priority == 1 && userIdKeyReplacer.get()?.t) {
121
121
  const coll = collection(db, [getEventPath(), path, event_id].join('/'));
122
122
  const q = query(coll, orderBy('t', 'asc'), where("t", "==", userIdKeyReplacer.get().t));
123
123
  getDocs(q).then((doc) => {
@@ -168,17 +168,19 @@ export default function useFirebaseSocket() {
168
168
  // get weather function
169
169
 
170
170
  function getQueue(path: string, event_id: string, _limit: number, cb: (idx: number, key: string) => void) {
171
- const instance: any = esp.mod("firestore/index")().instance()
172
- const db = getFirestore(instance)
173
- const coll = collection(db, [getEventPath(), path, event_id].join('/'));
174
- const q = query(coll, orderBy('s', 'asc'), where("s", "<", userIdKeyReplacer.get().s));
171
+ if (userIdKeyReplacer.get()?.s) {
172
+ const instance: any = esp.mod("firestore/index")().instance()
173
+ const db = getFirestore(instance)
174
+ const coll = collection(db, [getEventPath(), path, event_id].join('/'));
175
+ const q = query(coll, orderBy('s', 'asc'), where("s", "<", userIdKeyReplacer.get().s));
176
+ getCountFromServer(q).then((v) => {
177
+ cb(v.data().count, userIdKeyReplacer.get().id)
178
+ }).catch((e) => {
179
+ getQueue(path, event_id, _limit, cb)
180
+ console.log({ e })
181
+ })
182
+ }
175
183
 
176
- getCountFromServer(q).then((v) => {
177
- cb(v.data().count, userIdKeyReplacer.get().id)
178
- }).catch((e) => {
179
- getQueue(path, event_id, _limit, cb)
180
- console.log({ e })
181
- })
182
184
  // /* cleanup */
183
185
  // const cdate = getDateTimebyGmt7().getTime()
184
186
  // if (!cdate) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay-event",
3
- "version": "0.0.2-a",
3
+ "version": "0.0.2-b",
4
4
  "description": "event module on esoftplay framework",
5
5
  "main": "index.js",
6
6
  "scripts": {