Skip to content

Commit 227158c

Browse files
committed
fix in page copy logic
1 parent ba9bbfa commit 227158c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

admin-ui/src/views/InvoiceCreate.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,9 @@ const copyInvoice = async () => {
629629
isCopyLoading.value = true;
630630
631631
try {
632-
await store.dispatch("invoices/copy", invoice.value);
632+
const data = await store.dispatch("invoices/copy", invoice.value);
633+
router.push({ name: "Invoice page", params: { uuid: data.uuid } });
634+
633635
store.commit("snackbar/showSnackbarSuccess", { message: "Done" });
634636
} catch (e) {
635637
store.commit("snackbar/showSnackbarError", { message: e.message });

admin-ui/src/views/InvoicePage.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</template>
3434

3535
<script setup>
36-
import { computed, onMounted, ref } from "vue";
36+
import { computed, onMounted, ref, watch } from "vue";
3737
import { useRoute } from "vue-router/composables";
3838
import { useStore } from "@/store";
3939
import config from "@/config.js";
@@ -54,13 +54,17 @@ const invoiceTitle = computed(() =>
5454
onMounted(() => {
5555
store.commit("reloadBtn/setCallback", {
5656
type: "invoices/get",
57-
params: route.params?.uuid,
57+
params: invoiceId.value,
5858
});
5959
selectedTab.value = route.query.tab || 0;
6060
6161
refreshInvoice();
6262
});
6363
64+
const invoiceId = computed(() => {
65+
return route.params.uuid;
66+
});
67+
6468
const isInvoiceLoading = computed(() => {
6569
return store.getters["invoices/isLoading"];
6670
});
@@ -86,12 +90,16 @@ function navTitle(title) {
8690
8791
const refreshInvoice = async () => {
8892
try {
89-
await store.dispatch("invoices/get", route.params.uuid);
93+
await store.dispatch("invoices/get", invoiceId.value);
9094
document.title = `${invoiceTitle.value} | NoCloud`;
9195
} catch (e) {
9296
store.commit("snackbar/showSnackbarError", { message: e.message });
9397
}
9498
};
99+
100+
watch(invoiceId, () => {
101+
refreshInvoice();
102+
});
95103
</script>
96104
97105
<script>

0 commit comments

Comments
 (0)