Click to introduce yourself to other freeglers by telling us a bit about
diff --git a/components/OurMessage.vue b/components/OurMessage.vue
index 40585284..bf570ce2 100644
--- a/components/OurMessage.vue
+++ b/components/OurMessage.vue
@@ -251,7 +251,7 @@ export default {
},
async showPhotosModal() {
await this.waitForRef('photoModal')
- this.$refs.photoModal.show()
+ this.$refs.photoModal?.show()
},
async view() {
if (this.recordView) {
diff --git a/components/OutcomeModal.vue b/components/OutcomeModal.vue
index 2f99bba9..8ebd00fe 100644
--- a/components/OutcomeModal.vue
+++ b/components/OutcomeModal.vue
@@ -321,7 +321,7 @@ export default {
},
mounted() {
if (this.$refs.userselect) {
- this.$refs.userselect.show()
+ this.$refs.userselect?.show()
}
},
methods: {
diff --git a/components/PostPhoto.vue b/components/PostPhoto.vue
index ed5a0758..211f9649 100644
--- a/components/PostPhoto.vue
+++ b/components/PostPhoto.vue
@@ -89,7 +89,7 @@ export default {
async remove() {
this.confirm = true
await this.waitForRef('confirm')
- this.$refs.confirm.show()
+ this.$refs.confirm?.show()
},
removeConfirmed() {
this.$emit('remove', this.id)
diff --git a/components/ProfileInfo.vue b/components/ProfileInfo.vue
index fc315b76..67a85b85 100644
--- a/components/ProfileInfo.vue
+++ b/components/ProfileInfo.vue
@@ -284,7 +284,7 @@ export default {
this.showSupporterInfo = true
await this.waitForRef('supporterInfoModal')
- this.$refs.supporterInfoModal.show()
+ this.$refs.supporterInfoModal?.show()
},
},
}
diff --git a/components/PromiseModal.vue b/components/PromiseModal.vue
index 99fc20df..65036dc5 100644
--- a/components/PromiseModal.vue
+++ b/components/PromiseModal.vue
@@ -276,6 +276,7 @@ export default {
if (this.currentlySelected > 0) {
await this.messageStore.promise(this.message, this.currentlySelected)
+ console.log('Date arranged for', this.time, this.date)
const arrangedfor =
this.time && this.date
? dayjs(this.date + ' ' + this.time).toISOString()
diff --git a/components/SpinButton.vue b/components/SpinButton.vue
index 781eebd2..b39938a4 100644
--- a/components/SpinButton.vue
+++ b/components/SpinButton.vue
@@ -99,7 +99,7 @@ const click = async () => {
if (props.confirm) {
showConfirm.value = true
await waitForRef(modal)
- modal.value.show()
+ modal.value?.show()
} else {
doIt()
}
diff --git a/components/StoryOne.vue b/components/StoryOne.vue
index 0c2c035c..d610e4c7 100644
--- a/components/StoryOne.vue
+++ b/components/StoryOne.vue
@@ -137,7 +137,7 @@ export default {
async share(story) {
this.showShare = true
await this.waitForRef('share')
- this.$refs.share.show()
+ this.$refs.share?.show()
},
async love() {
await this.storyStore.love(this.id)
diff --git a/components/SupporterInfo.vue b/components/SupporterInfo.vue
index 5addfc75..bc447255 100644
--- a/components/SupporterInfo.vue
+++ b/components/SupporterInfo.vue
@@ -46,7 +46,7 @@ export default {
e.stopPropagation()
this.showInfoModal = true
await this.waitForRef('modal')
- this.$refs.modal.show()
+ this.$refs.modal?.show()
},
},
}
diff --git a/components/VolunteerOpportunity.vue b/components/VolunteerOpportunity.vue
index 0baa5800..5898f712 100644
--- a/components/VolunteerOpportunity.vue
+++ b/components/VolunteerOpportunity.vue
@@ -286,7 +286,7 @@ export default {
async showOpportunityModal() {
this.showModal = true
await this.waitForRef('opportunitymodal')
- this.$refs.opportunitymodal.show()
+ this.$refs.opportunitymodal?.show()
},
async renew() {
await this.volunteeringStore.renew(this.volunteering.id)
diff --git a/composables/useCompose.js b/composables/useCompose.js
index a2ed65d5..3bf91cad 100644
--- a/composables/useCompose.js
+++ b/composables/useCompose.js
@@ -52,7 +52,9 @@ export function setup(type) {
})
const route = useRoute()
- const initialPostcode = route.query.postcode ?? composeStore.postcode?.name
+ const initialPostcode = route.query.postcode
+ ? route.query.postcode
+ : composeStore.postcode?.name
// We want to refetch the group in case its closed status has changed.
const groupid = composeStore.group
diff --git a/composables/useThrottle.js b/composables/useThrottle.js
index 5bfa5645..d1b20553 100644
--- a/composables/useThrottle.js
+++ b/composables/useThrottle.js
@@ -37,7 +37,8 @@ export async function fetchOurOffers() {
// Get our offers.
const myid = authStore.user?.id
- let ours = await messageStore.fetchByUser(myid)
+
+ let ours = myid ? await messageStore.fetchByUser(myid) : []
// Truncate to 100
ours = ours.slice(0, 100)
diff --git a/composables/useWaitForRef.js b/composables/useWaitForRef.js
index 07745dca..272a19ba 100644
--- a/composables/useWaitForRef.js
+++ b/composables/useWaitForRef.js
@@ -1,10 +1,12 @@
function waitForRefTimer(ref, resolve) {
- if (ref.value) {
- resolve()
- } else {
- setTimeout(() => {
- waitForRefTimer(ref, resolve)
- }, 100)
+ if (ref) {
+ if (ref.value) {
+ resolve(ref.value)
+ } else {
+ setTimeout(() => {
+ waitForRefTimer(ref, resolve)
+ }, 100)
+ }
}
}
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 9e484163..6f6e8393 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -22,7 +22,7 @@ export default defineNuxtConfig({
// - server: requires a node server.
// - ssr can be:
// - true: renders at
- // - generate time for target: static, or
+ // - generate time for https://github.com/nuxt/framework/discussions/4523: static, or
// - in node server for target: server)
// - false: renders on client.
//
@@ -75,7 +75,7 @@ export default defineNuxtConfig({
//
// prerender: true - this will be generated at build time.
// static: true - this is generated on demand, and then cached until the next build
- // swr: 'time' - this is generated on demand each 'time' period.
+ // isr: 'time' - this is generated on demand each 'time' period.
// ssr: false - this is client-side rendered.
//
// There are potential issues where a deployment happens while a page is partway through loading assets, or
@@ -117,15 +117,15 @@ export default defineNuxtConfig({
'/teams': { ssr: false },
// Render on demand - may never be shown in a given build - then cache for a while.
- '/explore/region/**': { swr: 3600 },
- '/communityevent/**': { swr: 3600 },
- '/communityevents/**': { swr: 3600 },
- '/explore/**': { swr: 3600 },
- '/message/**': { swr: 600 },
- '/story/**': { swr: 3600 },
- '/shortlink/**': { swr: 600 },
- '/volunteering/**': { swr: 3600 },
- '/volunteerings/**': { swr: 3600 },
+ '/explore/region/**': { isr: 3600 },
+ '/communityevent/**': { isr: 3600 },
+ '/communityevents/**': { isr: 3600 },
+ '/explore/**': { isr: 3600 },
+ '/message/**': { isr: 600 },
+ '/story/**': { isr: 3600 },
+ '/shortlink/**': { isr: 600 },
+ '/volunteering/**': { isr: 3600 },
+ '/volunteerings/**': { isr: 3600 },
// Allow CORS for chunk fetches - required for Netlify hosting.
'/_nuxt/**': {
@@ -158,18 +158,6 @@ export default defineNuxtConfig({
emitRouteChunkError: 'reload',
},
- build: {
- // Need to transpile otherwise SSR fails - see https://github.com/nuxt/framework/discussions/4523.
- transpile: [
- /bootstrap-vue-3/,
- /vue3-lazyload/,
- /vue-image-zoomer/,
- /vue3-draggable-resizable/,
- /pinia-plugin-persist/,
- /vue-social-sharing/,
- ],
- },
-
webpack: {
// Reduce size of CSS initial load.
extractCSS: true,
diff --git a/pages/browse/[[term]].vue b/pages/browse/[[term]].vue
index 744d27a2..2c40f1d0 100644
--- a/pages/browse/[[term]].vue
+++ b/pages/browse/[[term]].vue
@@ -229,7 +229,7 @@ export default {
// Not asked too recently.
await this.fetchMe(true)
- if (this.me && (!this.me.aboutme || !this.me.aboutme.text)) {
+ if (!this.me.aboutme || !this.me.aboutme.text) {
// We have not yet provided one.
const daysago = dayjs().diff(dayjs(this.me.added), 'days')
diff --git a/pages/chats/[[id]].vue b/pages/chats/[[id]].vue
index 2c1c1331..6c489365 100644
--- a/pages/chats/[[id]].vue
+++ b/pages/chats/[[id]].vue
@@ -180,7 +180,7 @@ export default {
const id = route.params.id ? parseInt(route.params.id) : 0
// Fetch the list of chats.
- await chatStore.fetchChats(null, true, !!id)
+ await chatStore.fetchChats(null, true, id)
// Is this chat in the list?
let chat = chatStore.byChatId(id)
@@ -279,9 +279,6 @@ export default {
},
},
watch: {
- id(newVal) {
- console.log('id changed', newVal)
- },
search(newVal, oldVal) {
this.showChats = this.minShowChats
this.bump++
@@ -304,7 +301,9 @@ export default {
}
},
beforeUnmount() {
- this.chatStore.searchSince = null
+ if (this.chatStore) {
+ this.chatStore.searchSince = null
+ }
},
methods: {
async fetchOlder() {
@@ -372,7 +371,8 @@ export default {
const val2 = this.searchlast
this.searching = this.searchlast
this.searchlast = null
- await this.chatStore.fetchChats(this.searchSince, val2)
+ this.chatStore.searchSince = this.searchSince
+ await this.chatStore.fetchChats(val2)
this.showChats = this.minShowChats
this.bump++
}
diff --git a/pages/explore/join/[[id]].vue b/pages/explore/join/[[id]].vue
index ac79eba1..332599e6 100644
--- a/pages/explore/join/[[id]].vue
+++ b/pages/explore/join/[[id]].vue
@@ -68,7 +68,7 @@ export default {
async join() {
const group = this.groupStore?.get(this.id)
- await this.authStore.joinGroup(this.myid, this.id)
+ await this.authStore.joinGroup(this.myid, this.id, true)
// Route back.
const router = useRouter()
diff --git a/pages/mydata.vue b/pages/mydata.vue
index 4a7060b3..5bcc6d54 100644
--- a/pages/mydata.vue
+++ b/pages/mydata.vue
@@ -923,12 +923,6 @@ export default {
}
},
showEvent(id) {
- console.log(
- 'Refs',
- this.$refs['eventmodal-' + id],
- id,
- 'eventmodal-' + id
- )
this.$refs['eventmodal-' + id].show()
},
download() {
diff --git a/pages/settings/index.vue b/pages/settings/index.vue
index 7117cfe0..965be27f 100644
--- a/pages/settings/index.vue
+++ b/pages/settings/index.vue
@@ -340,25 +340,31 @@
-
- If people message you, you won't get any emails. Please make
- sure you check Chats regularly so that you don't miss
- anything.
-
-
-
-
+
+ You can set your email settings once you have joined a
+ community.
+
+
+
+ If people message you, you won't get any emails. Please
+ make sure you check Chats regularly so that you don't miss
+ anything.
+
+
+
+
+
{
// the setup() method is still running (asynchronously) and therefore the ref is not really ready yet.
const api = useMiscStore().apiCount
if (this.$refs[name] && !api) {
- this.$nextTick(() => {
- this.$nextTick(() => {
- resolve()
- })
- })
+ resolve(this.$refs[name])
} else {
setTimeout(() => {
// Don't callback if the window is unloading - the ref may be removed under our feet which causes a
diff --git a/stores/address.js b/stores/address.js
index 389f84e2..36b73f7d 100644
--- a/stores/address.js
+++ b/stores/address.js
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { nextTick } from 'vue'
import api from '~/api'
export const useAddressStore = defineStore({
@@ -31,6 +32,7 @@ export const useAddressStore = defineStore({
}
} else if (this.fetching) {
await this.fetching
+ await nextTick()
} else {
this.fetching = api(this.config).address.fetchv2()
this.list = await this.fetching
diff --git a/stores/auth.js b/stores/auth.js
index 0378f175..7c8cff12 100644
--- a/stores/auth.js
+++ b/stores/auth.js
@@ -133,14 +133,31 @@ export const useAuthStore = defineStore({
clearRelated() {
this.userlist = []
},
+ disableGoogleAutoselect() {
+ if (
+ window &&
+ window.google &&
+ window.google.accounts &&
+ window.google.accounts.id
+ ) {
+ try {
+ console.log('Disable Google autoselect')
+ window?.google?.accounts?.id?.disableAutoSelect()
+ } catch (e) {
+ console.log('Ignore Google autoselect error', e)
+ }
+ } else {
+ console.log("Google not yet loaded so can't disable")
+ setTimeout(this.disableGoogleAutoselect, 100)
+ }
+ },
async logout() {
const mobileStore = useMobileStore()
- try {
- console.log('Disable Google autoselect')
- window?.google?.accounts?.id?.disableAutoSelect()
- } catch (e) {
- console.log('Ignore Google autoselect error', e)
- }
+
+ await this.$api.session.logout()
+
+ this.disableGoogleAutoselect()
+
if( mobileStore.isApp){
try {
await FacebookLogin.logout();
@@ -156,9 +173,6 @@ export const useAuthStore = defineStore({
this.logoutPushId()
}
-
- await this.$api.session.logout()
-
// We are going to reset the store, but there are a few things we want to preserve.
const loginCount = this.loginCount
const config = this.config
@@ -368,10 +382,11 @@ export const useAuthStore = defineStore({
await this.fetchUser()
return this.user
},
- async joinGroup(userid, groupid) {
+ async joinGroup(userid, groupid, manual) {
await this.$api.memberships.joinGroup({
userid,
groupid,
+ manual,
})
await this.fetchUser()
return this.user
diff --git a/stores/chat.js b/stores/chat.js
index 398474b0..123d6db5 100644
--- a/stores/chat.js
+++ b/stores/chat.js
@@ -19,7 +19,7 @@ export const useChatStore = defineStore({
this.config = config
this.route = useRoute()
},
- async fetchChats(search, logError, empty) {
+ async fetchChats(search, logError, keepChat) {
let since = null
if (this.searchSince) {
@@ -29,9 +29,10 @@ export const useChatStore = defineStore({
const chats = await api(this.config).chat.listChats(
since,
search,
- logError,
- empty
+ keepChat,
+ logError
)
+
this.list = chats
chats.forEach((c) => {
@@ -178,12 +179,18 @@ export const useChatStore = defineStore({
return id
},
async openChatToUser(params) {
- // We might have a type override. Otherwise open a user chat on FD and mod chat on MT.
- const id = await this.openChat({
+ // We might have a type override.
+ const data = {
chattype: params.chattype ? params.chattype : 'User2User',
groupid: params.groupid,
userid: params.userid,
- })
+ }
+
+ if ('updateRoster' in params) {
+ data.updateRoster = params.updateRoster
+ }
+
+ const id = await this.openChat(data)
return id
},
@@ -202,12 +209,16 @@ export const useChatStore = defineStore({
const myid = authStore.user?.id
if (myid) {
- // If we are looking at a specific chat then we want to make sure we don't lose it by polling to exclude
- // empty chats.
- const empty = this.route?.path?.startsWith('/chats/')
+ // If we are looking at a specific chat then we want to make sure we don't lose it by polling
+ let keepChat = null
+
+ if (this.route?.path?.startsWith('/chats/')) {
+ // Get id after /chats/
+ keepChat = parseInt(this.route.path.substring(7))
+ }
// Don't want to log any errors to Sentry - they can happen due to timing windows.
- await this.fetchChats(null, false, empty)
+ await this.fetchChats(null, false, keepChat)
}
setTimeout(this.pollForChatUpdates, 30000)
diff --git a/stores/communityevent.js b/stores/communityevent.js
index 9266a3d1..fc7e711a 100644
--- a/stores/communityevent.js
+++ b/stores/communityevent.js
@@ -1,5 +1,6 @@
import { defineStore } from 'pinia'
import dayjs from 'dayjs'
+import { nextTick } from 'vue'
import api from '~/api'
import { earliestDate, addStrings } from '~/composables/useTimeFormat'
@@ -20,6 +21,7 @@ export const useCommunityEventStore = defineStore({
if (force || !this.list[id]) {
if (this.fetching[id]) {
await this.fetching[id]
+ await nextTick()
} else {
this.fetching[id] = api(this.config).communityevent.fetch(id, false)
let item = await this.fetching[id]
@@ -48,7 +50,7 @@ export const useCommunityEventStore = defineStore({
return this.list[id]
},
async fetchList(id) {
- this.forUser = await api(this.config).communityevent.list(id)
+ this.forUser = (await api(this.config).communityevent.list(id)) || []
},
async fetchGroup(id) {
this.forGroup = await api(this.config).communityevent.listGroup(id)
diff --git a/stores/group.js b/stores/group.js
index 6fa2066d..c10b931e 100644
--- a/stores/group.js
+++ b/stores/group.js
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { nextTick } from 'vue'
import api from '~/api'
export const useGroupStore = defineStore({
@@ -45,6 +46,7 @@ export const useGroupStore = defineStore({
if (this.fetching[id]) {
// Already fetching
await this.fetching[id]
+ await nextTick()
} else {
this.fetching[id] = api(this.config).group.fetch(
id,
diff --git a/stores/isochrone.js b/stores/isochrone.js
index 1f2956d6..c025d16c 100644
--- a/stores/isochrone.js
+++ b/stores/isochrone.js
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { nextTick } from 'vue'
import api from '~/api'
export const useIsochroneStore = defineStore({
@@ -21,6 +22,7 @@ export const useIsochroneStore = defineStore({
if (!this.list?.length || force) {
if (this.fetchingIsochrones) {
await this.fetchingIsochrones
+ await nextTick()
} else {
this.fetchingIsochrones = api(this.config).isochrone.fetchv2()
this.list = await this.fetchingIsochrones
@@ -42,6 +44,7 @@ export const useIsochroneStore = defineStore({
if (force || !this.messageList?.length) {
if (this.fetchingMessages) {
await this.fetchingMessages
+ await nextTick()
} else {
this.fetchingMessages = api(this.config).isochrone.fetchMessages()
this.messageList = await this.fetchingMessages
diff --git a/stores/job.js b/stores/job.js
index 010efe18..eaa8bf60 100644
--- a/stores/job.js
+++ b/stores/job.js
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { nextTick } from 'vue'
import api from '~/api'
export const useJobStore = defineStore({
@@ -29,6 +30,7 @@ export const useJobStore = defineStore({
if (!this.list?.length || force) {
if (this.fetching) {
await this.fetching
+ await nextTick()
} else {
this.fetching = api(this.config).job.fetchv2(lat, lng, category)
this.list = await this.fetching
diff --git a/stores/message.js b/stores/message.js
index 0b518bda..4cd3fb6f 100644
--- a/stores/message.js
+++ b/stores/message.js
@@ -1,5 +1,6 @@
import { defineStore } from 'pinia'
import dayjs from 'dayjs'
+import { nextTick } from 'vue'
import api from '~/api'
import { GROUP_REPOSTS, MESSAGE_EXPIRE_TIME } from '~/constants'
import { useGroupStore } from '~/stores/group'
@@ -36,6 +37,7 @@ export const useMessageStore = defineStore({
// Already fetching
try {
await this.fetching[id]
+ await nextTick()
} catch (e) {
console.log('Failed to fetch message', e)
if (e instanceof APIError && e.response.status === 404) {
@@ -51,12 +53,11 @@ export const useMessageStore = defineStore({
this.fetchingCount--
try {
- const message = await this.fetching[id]
+ this.list[id] = await this.fetching[id]
this.fetching[id] = null
- if (message) {
- message.addedToCache = Math.round(Date.now() / 1000)
- this.list[id] = message
+ if (this.list[id]) {
+ this.list[id].addedToCache = Math.round(Date.now() / 1000)
}
} catch (e) {
console.log('Failed to fetch message', e)
@@ -140,6 +141,7 @@ export const useMessageStore = defineStore({
if (this.fetchingMyGroups) {
ret = await this.fetchingMyGroups
+ await nextTick()
} else {
this.fetchingMyGroups = api(this.config).message.mygroups()
ret = await this.fetchingMyGroups
diff --git a/stores/newsfeed.js b/stores/newsfeed.js
index 13e925d8..4d0516dc 100644
--- a/stores/newsfeed.js
+++ b/stores/newsfeed.js
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { nextTick } from 'vue'
import api from '~/api'
export const useNewsfeedStore = defineStore({
@@ -69,6 +70,7 @@ export const useNewsfeedStore = defineStore({
}
const ret = await this.fetching[id]
+ await nextTick()
this.fetching[id] = null
if (ret?.id) {
diff --git a/stores/search.js b/stores/search.js
index 5b6406ae..d9a61eaf 100644
--- a/stores/search.js
+++ b/stores/search.js
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { nextTick } from 'vue'
import api from '~/api'
export const useSearchStore = defineStore({
@@ -14,6 +15,7 @@ export const useSearchStore = defineStore({
async fetch(userid) {
if (this.fetching) {
await this.fetching
+ await nextTick()
} else {
this.fetching = api(this.config).usersearch.fetch(userid)
this.list = await this.fetching
diff --git a/stores/stories.js b/stores/stories.js
index 2aaea886..c092c71f 100644
--- a/stores/stories.js
+++ b/stores/stories.js
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { nextTick } from 'vue'
import api from '~/api'
export const useStoryStore = defineStore({
@@ -15,6 +16,7 @@ export const useStoryStore = defineStore({
if (force || !this.list[id]) {
if (this.fetching[id]) {
await this.fetching[id]
+ await nextTick()
} else {
this.fetching[id] = api(this.config).stories.fetchv2(id)
this.list[id] = await this.fetching[id]
diff --git a/stores/team.js b/stores/team.js
index 7b82c289..4bb4f279 100644
--- a/stores/team.js
+++ b/stores/team.js
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { nextTick } from 'vue'
import api from '~/api'
export const useTeamStore = defineStore({
@@ -14,6 +15,7 @@ export const useTeamStore = defineStore({
async fetch(team) {
if (team in this.fetching) {
await this.fetching[team]
+ await nextTick()
} else {
this.fetching[team] = api(this.config).team.fetch({
name: team,
diff --git a/stores/tryst.js b/stores/tryst.js
index f1b271fd..cc2013eb 100644
--- a/stores/tryst.js
+++ b/stores/tryst.js
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { nextTick } from 'vue'
import api from '~/api'
export const useTrystStore = defineStore({
@@ -16,6 +17,7 @@ export const useTrystStore = defineStore({
async fetch() {
if (this.fetching) {
await this.fetching
+ await nextTick()
} else {
this.fetching = api(this.config).tryst.fetch()
const { trysts } = await this.fetching
@@ -56,12 +58,14 @@ export const useTrystStore = defineStore({
return state.list.find((i) => i.id === id)
},
getByUser: (state) => (userid) => {
- return Object.values(state.list).find((i) => {
- return (
- parseInt(i.user1) === parseInt(userid) ||
- parseInt(i.user2) === parseInt(userid)
- )
- })
+ if (state.list) {
+ return Object.values(state.list).find((i) => {
+ return (
+ parseInt(i.user1) === parseInt(userid) ||
+ parseInt(i.user2) === parseInt(userid)
+ )
+ })
+ }
},
},
})
diff --git a/stores/user.js b/stores/user.js
index 0095f2ee..f5c845f7 100644
--- a/stores/user.js
+++ b/stores/user.js
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { nextTick } from 'vue'
import api from '~/api'
export const useUserStore = defineStore({
@@ -23,6 +24,7 @@ export const useUserStore = defineStore({
if (force || !this.list[id]) {
if (this.fetching[id]) {
await this.fetching[id]
+ await nextTick()
} else {
this.fetching[id] = api(this.config).user.fetch(id)
const user = await this.fetching[id]
@@ -43,6 +45,7 @@ export const useUserStore = defineStore({
if (force || !this.locationList[id]) {
if (this.fetchingLocation[id]) {
await this.fetchingLocation[id]
+ await nextTick()
} else {
this.fetchingLocation[id] = api(this.config).user.fetchPublicLocation(
id
diff --git a/stores/volunteering.js b/stores/volunteering.js
index 36220b26..24675593 100644
--- a/stores/volunteering.js
+++ b/stores/volunteering.js
@@ -1,5 +1,6 @@
import { defineStore } from 'pinia'
import dayjs from 'dayjs'
+import { nextTick } from 'vue'
import api from '~/api'
import { addStrings, earliestDate } from '~/composables/useTimeFormat'
@@ -20,6 +21,7 @@ export const useVolunteeringStore = defineStore({
if (force || !this.list[id]) {
if (this.fetching[id]) {
await this.fetching[id]
+ await nextTick()
} else {
this.fetching[id] = api(this.config).volunteering.fetch(id, false)
let item = await this.fetching[id]
@@ -48,7 +50,7 @@ export const useVolunteeringStore = defineStore({
return this.list[id]
},
async fetchList(id) {
- this.forUser = await api(this.config).volunteering.list(id)
+ this.forUser = (await api(this.config).volunteering.list(id)) || []
},
async fetchGroup(id) {
this.forGroup = await api(this.config).volunteering.listGroup(id)