feat: move inboxes get to provider
This commit is contained in:
@@ -78,7 +78,14 @@ export const ChatwootProvider = ({
|
||||
window.axios = createAxios(axios);
|
||||
|
||||
// Initialize user in store and ActionCable
|
||||
store.dispatch('setUser').then(() => {
|
||||
store.dispatch('setUser').then(async () => {
|
||||
// Fetch inboxes once per session. Guarded against the shared Vuex store
|
||||
// so remounting the provider (e.g. when the consumer re-keys per
|
||||
// conversation) doesn't trigger redundant /inboxes requests.
|
||||
const hasInboxes = store.getters['inboxes/getInboxes'].length > 0;
|
||||
if (!hasInboxes) {
|
||||
await store.dispatch('inboxes/get');
|
||||
}
|
||||
vueActionCable.init(store, config.pubsubToken);
|
||||
setInitializationComplete(true);
|
||||
});
|
||||
|
||||
@@ -74,7 +74,6 @@ const fetchMore = async () => {
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await store.dispatch('inboxes/get');
|
||||
await Promise.all([
|
||||
store.dispatch('getConversation', conversationId.value),
|
||||
store.dispatch('fetchAllAttachments', conversationId.value),
|
||||
|
||||
Reference in New Issue
Block a user