Skip to content

Commit

Permalink
chore: disable auto import
Browse files Browse the repository at this point in the history
  • Loading branch information
becem-gharbi committed Mar 11, 2024
1 parent d5e2619 commit be260b3
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .nuxtrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports.autoImport=false
typescript.includeWorkspace=true
5 changes: 1 addition & 4 deletions playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
<div>
<NuxtPage />
</div>
</template>

<script setup lang="ts">
</script>
</template>
1 change: 1 addition & 0 deletions playground/pages/auth/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
</template>

<script setup lang="ts">
import { definePageMeta, useDirectusAuth, ref } from '#imports'
definePageMeta({ middleware: 'guest' })
Expand Down
3 changes: 3 additions & 0 deletions playground/pages/auth/reset-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
</template>

<script setup>
import { definePageMeta, useDirectusAuth } from '#imports'
definePageMeta({ middleware: 'guest' })
const { resetPassword } = useDirectusAuth()
</script>
2 changes: 1 addition & 1 deletion playground/pages/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</template>

<script setup lang="ts">
import { readItems } from "@directus/sdk";
import { definePageMeta, useLazyQuery, gql, useDirectusAuth, useDirectusRest, readItems, useAsyncData } from '#imports'
definePageMeta({ middleware: "auth" });
Expand Down
2 changes: 2 additions & 0 deletions playground/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
</template>

<script setup>
import { definePageMeta } from '#imports'
definePageMeta({ middleware: 'guest' })
</script>
2 changes: 2 additions & 0 deletions playground/plugins/auth.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {defineNuxtPlugin} from '#imports'

export default defineNuxtPlugin({
enforce: 'pre',
hooks: {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/plugins/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
const firstTime = (process.server && !isPrerenderd && isPageFound) || (process.client && (!isServerRendered || isPrerenderd || !isPageFound))

if (firstTime) {
const isCallback = useRoute().path === config.auth.redirect.callback
const isCallback = router.currentRoute.value?.path === config.auth.redirect.callback
const { _refreshToken, refresh } = useDirectusSession()

if (isCallback || _loggedInFlag.value || _refreshToken.get()) {
Expand Down

0 comments on commit be260b3

Please sign in to comment.