feat: Add Pinia support and relocate store factory (#12854)

Co-authored-by: Vinay Keerthi <11478411+stonecharioteer@users.noreply.github.com>
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
Sivin Varghese
2025-11-28 16:31:59 +05:30
committed by GitHub
parent 1ef945de7b
commit f23d95e004
24 changed files with 1341 additions and 603 deletions

View File

@@ -1,29 +0,0 @@
import CompanyAPI from 'dashboard/api/companies';
import { createStore } from 'dashboard/store/captain/storeFactory';
import camelcaseKeys from 'camelcase-keys';
export default createStore({
name: 'Company',
API: CompanyAPI,
getters: {
getCompaniesList: state => {
return camelcaseKeys(state.records, { deep: true });
},
},
actions: mutationTypes => ({
search: async ({ commit }, { search, page, sort }) => {
commit(mutationTypes.SET_UI_FLAG, { fetchingList: true });
try {
const {
data: { payload, meta },
} = await CompanyAPI.search(search, page, sort);
commit(mutationTypes.SET, payload);
commit(mutationTypes.SET_META, meta);
} catch (error) {
// Error
} finally {
commit(mutationTypes.SET_UI_FLAG, { fetchingList: false });
}
},
}),
});