salix-front/src/stores/useArrayDataStore.js

35 lines
652 B
JavaScript
Raw Normal View History

2023-01-05 13:57:47 +00:00
import { ref } from 'vue';
import { defineStore } from 'pinia';
export const useArrayDataStore = defineStore('arrayDataStore', () => {
2023-01-10 13:58:24 +00:00
const state = ref({});
2023-01-05 13:57:47 +00:00
function get(key) {
2023-01-10 13:58:24 +00:00
return state.value[key];
2023-01-05 13:57:47 +00:00
}
2023-01-10 13:58:24 +00:00
function set(key) {
2023-03-01 15:20:28 +00:00
state.value[key] = {
2023-01-14 12:48:57 +00:00
filter: {},
userFilter: {},
userParams: {},
url: '',
limit: 10,
skip: 0,
order: '',
2023-03-01 15:20:28 +00:00
data: ref(),
2023-03-21 08:49:47 +00:00
isLoading: false
2023-01-14 12:48:57 +00:00
};
2023-01-10 13:58:24 +00:00
}
function clear(key) {
delete state.value[key];
2023-01-05 13:57:47 +00:00
}
return {
get,
set,
2023-03-01 15:20:28 +00:00
clear,
2023-01-05 13:57:47 +00:00
};
});