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

fix(types): add explicit type annotations for plugins #408

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }>