[pricelist] Fixed store issue
This commit is contained in:
parent
61ed9e70e2
commit
f28e597d53
|
@ -69,7 +69,7 @@ import { notEmpty } from 'src/utils/validators';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'NewDrink',
|
name: 'NewDrink',
|
||||||
emits: { close },
|
emits: { close: () => true },
|
||||||
setup(_, { emit }) {
|
setup(_, { emit }) {
|
||||||
const store = usePricelistStore();
|
const store = usePricelistStore();
|
||||||
const emptyDrink: FG.Drink = {
|
const emptyDrink: FG.Drink = {
|
||||||
|
@ -108,13 +108,14 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function addDrink() {
|
async function addDrink() {
|
||||||
void store.setDrink(newDrink.value);
|
// Maybe try catch and handle error (e.g. name used...)
|
||||||
|
await store.setDrink(newDrink.value);
|
||||||
cancelAddDrink();
|
cancelAddDrink();
|
||||||
setTimeout(() => emit('close'), 200);
|
emit('close');
|
||||||
}
|
}
|
||||||
function cancelAddDrink() {
|
function cancelAddDrink() {
|
||||||
setTimeout(() => (newDrink.value = emptyDrink), 200);
|
newDrink.value = emptyDrink;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newDrink = ref<FG.Drink>(emptyDrink);
|
const newDrink = ref<FG.Drink>(emptyDrink);
|
||||||
|
|
Loading…
Reference in New Issue