Skip to content

Commit

Permalink
fix modal not opening a second time
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbitronics committed Jan 29, 2025
1 parent e6246e8 commit 5034b88
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</v-row>

<v-container>
<v-dialog v-model="isModalOpen" max-width="400">
<v-dialog @after-leave="closeModal" v-model="isModalOpen" max-width="400">

Check warning on line 39 in src/App.vue

View workflow job for this annotation

GitHub Actions / Build

Attribute "v-model" should go before "@after-leave"

Check warning on line 39 in src/App.vue

View workflow job for this annotation

GitHub Actions / Build

Attribute "max-width" should go before "@after-leave"
<v-card>
<v-card-title>
<v-icon color="error" class="mr-2">mdi-alert</v-icon>
Expand Down Expand Up @@ -78,18 +78,17 @@ const { xs } = useDisplay()
const route = useRoute()
watch(message, (newValue) => {
if (newValue) isModalOpen.value = true
})
watch(
() => route.fullPath,
() => {
message.value = ''
isModalOpen.value = false // Close modal (if open)
},
)
watch(message, () => {
isModalOpen.value = !!message.value
})
onMounted(() => {
eventBus.on('clear-messages', () => {
message.value = ''
Expand All @@ -109,7 +108,6 @@ const login = () => {
const closeModal = () => {
message.value = ''
isModalOpen.value = false
}
</script>

Expand Down

0 comments on commit 5034b88

Please sign in to comment.