Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Vuetify] Unable to locate target [data-app] #145

Open
laurent-brisbois opened this issue Feb 7, 2022 · 0 comments
Open

[Vuetify] Unable to locate target [data-app] #145

laurent-brisbois opened this issue Feb 7, 2022 · 0 comments

Comments

@laurent-brisbois
Copy link

laurent-brisbois commented Feb 7, 2022

Hello there !

image

const router = new Router({
  //...
})

I have a beforeEach statement in my vue router that does this :

router.beforeEach(async (to, from, next) => {
  const isLoggedIn = getIsLoggedIn()
  // ...
  }
  if (to.meta.requiresAuth) {
    if (isLoggedIn) {
      // ...
    } else {
      let res = await router.app.$dialog.show(WarningModal, {
        persistent: true,
        waitForResult: true,
        icon: 'login',
        title: 'Warning: Login Required',
        message: 'Your session may have expired.',
        advice: 'Please log again and retry.',
        okColor: 'primary',
        okHandler: function () {
          return new Promise(resolve => {
            resolve()
          })
        }
      })
      if (res) {
        handleUnloggedStatus()
        router.push({ name: 'LoginForm' })
      }
    }
  } else {
    next()
  }
})

With the WarningModal modal being :

<template>
  <DialogCard :actions="actions">
    <v-toolbar
      flat
      dark
      color="warning">
      <v-toolbar-title>
        <v-icon left>mdi-{{ icon }}</v-icon>
        {{ title }}
      </v-toolbar-title>
    </v-toolbar>
    <div class="pa-4 subtitle-1">
      <div>{{ message }}</div>
      <div
        v-if="advice"
        class="mt-3">
        {{ advice }}
      </div>
      <v-checkbox
        v-if="checkRequired"
        v-model="checked"
        :label="checkMessage"
        dense/>
    </div>
  </DialogCard>
</template>

And when I start my app on a URL that requiresAuth, if I'm not logged in it tries to display the modal, which fails.
If I first login and do things, the modal is usable as normal because I use it for other purposes such as asking confirmation before a delete.

How can I solve this problem here ? Since it doesn't seem to be able to find v-app properly I think ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant