mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-04 16:50:27 +00:00
fix select first bug for creation
This commit is contained in:
parent
79f7ad40cb
commit
9a59f5eda6
1 changed files with 11 additions and 10 deletions
|
@ -37,13 +37,22 @@
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const api = useUserApi();
|
||||||
|
const toast = useNotifier();
|
||||||
|
|
||||||
|
const locationsStore = useLocationStore();
|
||||||
|
const locations = computed(() => locationsStore.locations);
|
||||||
|
|
||||||
|
const labelStore = useLabelStore();
|
||||||
|
const labels = computed(() => labelStore.labels);
|
||||||
|
|
||||||
const submitBtn = ref(null);
|
const submitBtn = ref(null);
|
||||||
|
|
||||||
const modal = useVModel(props, "modelValue");
|
const modal = useVModel(props, "modelValue");
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const focused = ref(false);
|
const focused = ref(false);
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
location: {} as LocationOut,
|
location: locations.value.length > 0 ? locations.value[0] : ({} as LocationOut),
|
||||||
name: "",
|
name: "",
|
||||||
description: "",
|
description: "",
|
||||||
color: "", // Future!
|
color: "", // Future!
|
||||||
|
@ -65,14 +74,6 @@
|
||||||
focused.value = true;
|
focused.value = true;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const api = useUserApi();
|
|
||||||
const toast = useNotifier();
|
|
||||||
|
|
||||||
const locationsStore = useLocationStore();
|
|
||||||
const locations = computed(() => locationsStore.locations);
|
|
||||||
|
|
||||||
const labelStore = useLabelStore();
|
|
||||||
const labels = computed(() => labelStore.labels);
|
|
||||||
|
|
||||||
async function create() {
|
async function create() {
|
||||||
if (!form.location) {
|
if (!form.location) {
|
||||||
|
@ -88,7 +89,7 @@
|
||||||
|
|
||||||
const { error } = await api.items.create(out);
|
const { error } = await api.items.create(out);
|
||||||
if (error) {
|
if (error) {
|
||||||
toast.error("Couldn't create label");
|
toast.error("Couldn't create item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue