Skip to content

Commit

Permalink
fix(types): add explicit type annotations for plugins (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
th1m0 authored Aug 30, 2024
1 parent 98ca959 commit 09bff84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/runtime/plugins/auth-redirect.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Plugin } from '#app'
import type { Ref } from '#imports'
import { defineNuxtPlugin, addRouteMiddleware, defineNuxtRouteMiddleware, useCookie, useRuntimeConfig, navigateTo, useSupabaseSession } from '#imports'
import type { RouteLocationNormalized } from '#vue-router'
Expand All @@ -24,7 +25,7 @@ export default defineNuxtPlugin({
}

// Do not redirect on login route, callback route and excluded routes
const isExcluded = [...exclude, login, callback]?.some((path) => {
const isExcluded = [...exclude ?? [], login, callback]?.some((path) => {
const regex = new RegExp(`^${path.replace(/\*/g, '.*')}$`)
return regex.test(to.path)
})
Expand All @@ -42,4 +43,4 @@ export default defineNuxtPlugin({
{ global: true },
)
},
})
}) as Plugin
5 changes: 3 additions & 2 deletions src/runtime/plugins/supabase.client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createBrowserClient } from '@supabase/ssr'
import type { Session } from '@supabase/supabase-js'
import type { Session, SupabaseClient } from '@supabase/supabase-js'
import { fetchWithRetry } from '../utils/fetch-retry'
import type { Plugin } from '#app'
import { defineNuxtPlugin, useRuntimeConfig, useSupabaseSession, useSupabaseUser } from '#imports'

export default defineNuxtPlugin({
Expand Down Expand Up @@ -43,4 +44,4 @@ export default defineNuxtPlugin({
},
}
},
})
}) as Plugin<{ client: SupabaseClient }>

0 comments on commit 09bff84

Please sign in to comment.