add: pagination to locations
This commit is contained in:
@@ -10,6 +10,8 @@ export const useCompanyStore = defineStore('company', () => {
|
||||
const users = ref([]);
|
||||
const budgets = ref([]);
|
||||
const locations = ref([]);
|
||||
const locationsTotal = ref(0);
|
||||
const locationsCurrentPage = ref(1);
|
||||
const proposals = ref([])
|
||||
const loading = ref(false);
|
||||
|
||||
@@ -239,6 +241,7 @@ export const useCompanyStore = defineStore('company', () => {
|
||||
console.log(resp);
|
||||
if(resp !== null && resp.total > 0) {
|
||||
locations.value = resp.data;
|
||||
locationsTotal.value = resp.total;
|
||||
} else {
|
||||
locations.value = [];
|
||||
}
|
||||
@@ -248,10 +251,11 @@ export const useCompanyStore = defineStore('company', () => {
|
||||
const createLocationCompany = async(formData, localData) => {
|
||||
const data = await createLocation(formData);
|
||||
if(data) {
|
||||
locations.value.push({
|
||||
locations.value.unshift({
|
||||
...data,
|
||||
...localData
|
||||
});
|
||||
locationsTotal.value++;
|
||||
return 'success';
|
||||
} else {
|
||||
return 'Algo salio mal, intente más tarde';
|
||||
@@ -306,6 +310,8 @@ export const useCompanyStore = defineStore('company', () => {
|
||||
budgets,
|
||||
users,
|
||||
locations,
|
||||
locationsTotal,
|
||||
locationsCurrentPage,
|
||||
clear,
|
||||
$reset,
|
||||
loading,
|
||||
|
||||
Reference in New Issue
Block a user