| 87 | |
| 88 | actions: { |
| 89 | async fetchRequiredInitialData ({ commit, dispatch }, { optionalIdOrSlug }) { |
| 90 | commit('setLoading', true) |
| 91 | try { |
| 92 | const fetchPromises = [dispatch('fetchMyClans'), dispatch('fetchPublicClans')] |
| 93 | if (optionalIdOrSlug) { |
| 94 | fetchPromises.push(dispatch('fetchClan', { idOrSlug: optionalIdOrSlug })) |
| 95 | } |
| 96 | await Promise.all(fetchPromises) |
| 97 | } catch (e) { |
| 98 | console.error(e) |
| 99 | } |
| 100 | commit('setLoading', false) |
| 101 | }, |
| 102 | |
| 103 | async fetchMyClans ({ commit }) { |
| 104 | const clans = await getMyClans() |