mirror of
https://github.com/chatwoot/chatwoot.git
synced 2026-06-13 21:01:16 +08:00
feat: move inboxes get to provider
This commit is contained in:
parent
fb75f8783f
commit
3bd4570580
@ -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),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user