Fix persisting client changes. Fix persisting team changes. Fix validating vat of 0.

This commit is contained in:
HenriT
2021-02-16 22:09:59 +02:00
parent b291455a05
commit 5cf166ca12
4 changed files with 6 additions and 12 deletions

View File

@ -40,7 +40,6 @@ export default {
} else if (window.matchMedia('(prefers-color-scheme: dark)').matches) { } else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
// OS theme setting detected as dark // OS theme setting detected as dark
this.$store.commit('themes/theme', 'dark'); this.$store.commit('themes/theme', 'dark');
console.log('hello there');
return document.documentElement.setAttribute('data-theme', 'dark'); return document.documentElement.setAttribute('data-theme', 'dark');
} }
document.documentElement.setAttribute('data-theme', this.theme || 'light'); document.documentElement.setAttribute('data-theme', this.theme || 'light');

View File

@ -50,11 +50,9 @@ export default {
await dispatch('clientProps', props); await dispatch('clientProps', props);
return ClientService.updateClient(getters.client); return ClientService.updateClient(getters.client);
}, },
async updateClientById(payload) { async updateClientById(store, payload) {
const client = await Client.update({ const client = Client.find(payload.clientId);
where: payload.clientId, client.$update(payload.props);
data: payload.props,
});
return ClientService.updateClient(client); return ClientService.updateClient(client);
}, },
async openNewClientModal({ commit }) { async openNewClientModal({ commit }) {

View File

@ -27,11 +27,8 @@ export default {
await Team.create({ data: team }); await Team.create({ data: team });
return team; return team;
}, },
async teamProps({ state }, props) { async teamProps({ getters }, props) {
return Team.update({ return getters.team.$update(props);
where: state.teamId,
data: props,
});
}, },
async updateTeam({ getters, dispatch }, props) { async updateTeam({ getters, dispatch }, props) {
if (props) { if (props) {

View File

@ -59,7 +59,7 @@ export function validate(requiredFields, input) {
} }
export function validateField(input, field, label) { export function validateField(input, field, label) {
if (!input.hasOwnProperty(field) || !input[field] || input[field].length === 0) { if (!input.hasOwnProperty(field) || input[field] === null || input[field].length === 0) {
return [`${label} is required`]; return [`${label} is required`];
} }
return null; return null;