fix(users/company): Update user and companies endpoint to v1
This commit is contained in:
@@ -29,7 +29,7 @@ export const useCompanyStore = defineStore('company', () => {
|
||||
loading.value = true;
|
||||
if(!company.value) {
|
||||
loading.value = true;
|
||||
const resp = await getCompany(companyId);
|
||||
const resp = await getCompany();
|
||||
company.value = resp;
|
||||
}
|
||||
loading.value = false;
|
||||
@@ -38,7 +38,7 @@ export const useCompanyStore = defineStore('company', () => {
|
||||
const getUsersCompany = async(limit = 10, skip = 0, reload = false) => {
|
||||
const companyId = localStorage.getItem('id');
|
||||
if(users.value.length <= 0 || reload === true) {
|
||||
const filter = `company=${companyId}&$sort%5BcreatedAt%5D=-1&$limit=${limit}&$skip=${skip}`
|
||||
const filter = `company=${companyId}`;
|
||||
const resp = await getUsers(filter);
|
||||
if(resp !== null && resp.total > 0) {
|
||||
usersTotal.value = resp.total;
|
||||
@@ -52,7 +52,7 @@ export const useCompanyStore = defineStore('company', () => {
|
||||
const getDrivers = async() => {
|
||||
const companyId = localStorage.getItem('id');
|
||||
if(drivers.value.length <= 0) {
|
||||
const filter = `company=${companyId}&$sort%5BcreatedAt%5D=-1&$limit=100&$skip=0&job_role=driver`
|
||||
const filter = `company=${companyId}&elements=100&job_role=driver`;
|
||||
const resp = await getUsers(filter);
|
||||
if(resp !== null && resp.total > 0) {
|
||||
drivers.value = resp.data;
|
||||
@@ -124,7 +124,7 @@ export const useCompanyStore = defineStore('company', () => {
|
||||
}
|
||||
|
||||
const editCompany = async(formData) => {
|
||||
const data = await updateCompany(company.value._id, formData);
|
||||
const data = await updateCompany(formData);
|
||||
if(data === null) {
|
||||
return 'Algo salio mal, intente más tarde';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user