[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({
|
||||
name: 'NewDrink',
|
||||
emits: { close },
|
||||
emits: { close: () => true },
|
||||
setup(_, { emit }) {
|
||||
const store = usePricelistStore();
|
||||
const emptyDrink: FG.Drink = {
|
||||
|
@ -108,13 +108,14 @@ export default defineComponent({
|
|||
},
|
||||
});
|
||||
|
||||
function addDrink() {
|
||||
void store.setDrink(newDrink.value);
|
||||
async function addDrink() {
|
||||
// Maybe try catch and handle error (e.g. name used...)
|
||||
await store.setDrink(newDrink.value);
|
||||
cancelAddDrink();
|
||||
setTimeout(() => emit('close'), 200);
|
||||
emit('close');
|
||||
}
|
||||
function cancelAddDrink() {
|
||||
setTimeout(() => (newDrink.value = emptyDrink), 200);
|
||||
newDrink.value = emptyDrink;
|
||||
}
|
||||
|
||||
const newDrink = ref<FG.Drink>(emptyDrink);
|
||||
|
|
Loading…
Reference in New Issue