sort tables ok
This commit is contained in:
@@ -1,94 +1,85 @@
|
||||
export const state = () => ({
|
||||
auth: null,
|
||||
notifications: [],
|
||||
fecha: fechaString(),
|
||||
categorias:[],
|
||||
metodos_de_pago:[]
|
||||
});
|
||||
auth: null,
|
||||
notifications: [],
|
||||
filtro: {fechas:fechaString().slice(0, 7),npresupuesto:5},
|
||||
fecha: fechaString(),
|
||||
categorias: [],
|
||||
metodos_de_pago: []
|
||||
});
|
||||
|
||||
export const mutations = {
|
||||
export const mutations = {
|
||||
setAuth(state, auth) {
|
||||
state.auth = auth;
|
||||
},
|
||||
|
||||
setAuth(state, auth) {
|
||||
state.auth = auth;
|
||||
},
|
||||
|
||||
setNotifications(state, notifications) {
|
||||
state.notifications = notifications;
|
||||
},
|
||||
setNotifications(state, notifications) {
|
||||
state.notifications = notifications;
|
||||
},
|
||||
|
||||
setCategorias(state, categorias) {
|
||||
state.categorias = categorias;
|
||||
},
|
||||
setCategorias(state, categorias) {
|
||||
state.categorias = categorias;
|
||||
},
|
||||
|
||||
setMetodos(state, metodos) {
|
||||
state.metodos_de_pago = metodos;
|
||||
},
|
||||
|
||||
|
||||
|
||||
};
|
||||
setMetodos(state, metodos) {
|
||||
state.metodos_de_pago = metodos;
|
||||
},
|
||||
actualizarFiltro(state,filtro) {
|
||||
|
||||
function fechaString(){
|
||||
let data = new Date();
|
||||
let year= data.getFullYear();
|
||||
let month = (data.getMonth() + 1)<9?"0"+(data.getMonth() + 1):(data.getMonth() + 1)
|
||||
let day = data.getDate()<9?"0"+data.getDate():data.getDate()
|
||||
let dataF=`${year}-${month}-${day}`
|
||||
return dataF;
|
||||
|
||||
state.filtro=filtro
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
function fechaString() {
|
||||
let data = new Date();
|
||||
let year = data.getFullYear();
|
||||
let month =
|
||||
data.getMonth() + 1 < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
|
||||
let day = data.getDate() < 9 ? "0" + data.getDate() : data.getDate();
|
||||
let dataF = `${year}-${month}-${day}`;
|
||||
return dataF;
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
|
||||
readToken() {
|
||||
let auth = null;
|
||||
try {
|
||||
auth = JSON.parse(localStorage.getItem("auth"));
|
||||
} catch (error) {
|
||||
console.log(err);
|
||||
readToken() {
|
||||
let auth = null;
|
||||
try {
|
||||
auth = JSON.parse(localStorage.getItem("auth"));
|
||||
} catch (error) {
|
||||
console.log(err);
|
||||
}
|
||||
//saving auth in state
|
||||
this.commit("setAuth", auth);
|
||||
},
|
||||
getCategorias() {
|
||||
const axiosHeader = {
|
||||
headers: {
|
||||
token: this.state.auth.token
|
||||
}
|
||||
//saving auth in state
|
||||
this.commit("setAuth", auth);
|
||||
},
|
||||
getCategorias() {
|
||||
|
||||
const axiosHeader = {
|
||||
headers: {
|
||||
token: this.state.auth.token
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
this.$axios.get("/categoria", axiosHeader)
|
||||
.then(res => {
|
||||
|
||||
this.commit("setCategorias", res.data.data);
|
||||
|
||||
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
this.$axios
|
||||
.get("/categoria", axiosHeader)
|
||||
.then(res => {
|
||||
this.commit("setCategorias", res.data.data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
|
||||
getMetodos() {
|
||||
|
||||
const axiosHeader = {
|
||||
headers: {
|
||||
token: this.state.auth.token,
|
||||
},
|
||||
token: this.state.auth.token
|
||||
}
|
||||
};
|
||||
this.$axios
|
||||
.get("/metodo", axiosHeader)
|
||||
.then((res) => {
|
||||
|
||||
.then(res => {
|
||||
this.commit("setMetodos", res.data.data);
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
}
|
||||
.catch(e => console.log(e));
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user