Skip to content

Commit

Permalink
fix: transaction group action redirect (#1423)
Browse files Browse the repository at this point in the history
Signed-off-by: Svetoslav Borislavov <[email protected]>
  • Loading branch information
SvetBorislavov authored Jan 8, 2025
1 parent 810e51d commit 0a06437
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions front-end/src/renderer/components/GroupActionModal.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script setup lang="ts">
import { ref } from 'vue';
import { onBeforeRouteLeave } from 'vue-router';
import { useRoute } from 'vue-router';
import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router';
import { redirectToPrevious } from '@renderer/utils';
import AppButton from '@renderer/components/ui/AppButton.vue';
import AppModal from '@renderer/components/ui/AppModal.vue';
Expand All @@ -13,6 +14,7 @@ const props = defineProps<{
}>();
/* Composables */
const router = useRouter();
const route = useRoute();
/* State */
Expand All @@ -39,9 +41,10 @@ function handleGroupAction() {
}
/* Hooks */
onBeforeRouteLeave(async () => {
onBeforeRouteLeave(async to => {
if (route.query.group == 'true' && isGroupActionModalShown.value == false && !props.skip) {
isGroupActionModalShown.value = true;
router.previousPath = to.path;
return false;
}
return true;
Expand All @@ -68,7 +71,7 @@ onBeforeRouteLeave(async () => {
color="borderless"
data-testid="button-discard-draft-for-group-modal"
type="button"
@click="$router.back()"
@click="redirectToPrevious(router, '/transactions')"
>Discard</AppButton
>
<AppButton
Expand Down

0 comments on commit 0a06437

Please sign in to comment.