Skip to content

Commit

Permalink
fix: confirm modal valid start (workaround!)
Browse files Browse the repository at this point in the history
Signed-off-by: Svetoslav Borislavov <[email protected]>
  • Loading branch information
SvetBorislavov committed Jan 22, 2025
1 parent 6db8e13 commit a6ba313
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ const props = defineProps<{
watchExecutedModalShown?: (shown: boolean) => void;
}>();
/* Emits */
defineEmits<{
(event: 'abort'): void;
}>();
/* Stores */
const user = useUserStore();
const network = useNetworkStore();
Expand Down Expand Up @@ -434,7 +439,10 @@ defineExpose({
<template #header>
<div class="d-flex flex-column w-100">
<div>
<i class="bi bi-x-lg cursor-pointer" @click="isConfirmShown = false"></i>
<i
class="bi bi-x-lg cursor-pointer"
@click="((isConfirmShown = false), $emit('abort'))"
></i>
</div>
<div class="text-center">
<i class="bi bi-arrow-left-right large-icon"></i>
Expand Down Expand Up @@ -468,7 +476,10 @@ defineExpose({
<hr class="separator m-5" />

<div class="flex-between-centered gap-4 w-100 px-5 pb-5">
<AppButton type="button" color="borderless" @click="isConfirmShown = false"
<AppButton
type="button"
color="borderless"
@click="((isConfirmShown = false), $emit('abort'))"
>Cancel</AppButton
>
<AppButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const transactionGroupProcessor = ref<typeof TransactionGroupProcessor | null>(n
const file = ref<HTMLInputElement | null>(null);
const wantToDeleteModalShown = ref(false);
const showAreYouSure = ref(false);
const updateValidStarts = ref(true);
const groupEmpty = computed(() => transactionGroup.groupItems.length == 0);
Expand Down Expand Up @@ -167,8 +168,10 @@ async function handleSignSubmit() {
}
const requiredKey = new KeyList(ownerKeys);
updateValidStarts.value = false;
await transactionGroupProcessor.value?.process(requiredKey);
} catch (error) {
updateValidStarts.value = true;
toast.error(getErrorMessage(error, 'Failed to create transaction'));
}
}
Expand Down Expand Up @@ -300,7 +303,9 @@ async function handleOnFileChanged(e: Event) {
function updateGroupValidStart(newDate: Date) {
transactionGroup.groupValidStart = newDate;
transactionGroup.updateTransactionValidStarts(transactionGroup.groupValidStart);
if (updateValidStarts.value) {
transactionGroup.updateTransactionValidStarts(transactionGroup.groupValidStart);
}
}
/* Functions */
Expand Down Expand Up @@ -528,6 +533,7 @@ onBeforeRouteLeave(async to => {
:on-close-success-modal-click="handleClose"
:on-executed="handleExecuted"
:on-submitted="handleSubmit"
@abort="updateValidStarts = true"
>
<template #successHeading>Transaction Group Executed Successfully</template>
</TransactionGroupProcessor>
Expand Down

0 comments on commit a6ba313

Please sign in to comment.