Skip to content

Commit

Permalink
fix(module): priority of redirect options made by defu (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
52cs authored Sep 6, 2023
1 parent d31d63b commit c4e30bf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ export default defineNuxtModule<ModuleOptions>({
})

// ensure callback URL is not using SSR
if (options.redirect && options.redirectOptions.callback) {
// && options.redirectOptions.login) {
if (nuxt.options.runtimeConfig.public.supabase.redirect
&& nuxt.options.runtimeConfig.public.supabase.redirectOptions.callback) {
// && nuxt.options.runtimeConfig.public.supabase.redirectOptions.login) {
const routeRules: { [key: string]: any } = {}
routeRules[options.redirectOptions.callback] = { ssr: false }
//routeRules[options.redirectOptions.login] = { ssr: false }
routeRules[nuxt.options.runtimeConfig.public.supabase.redirectOptions.callback] = { ssr: false }
//routeRules[nuxt.options.runtimeConfig.public.supabase.redirectOptions.login] = { ssr: false }
nuxt.options.nitro = defu(nuxt.options.nitro, {
routeRules,
})
Expand All @@ -169,7 +170,7 @@ export default defineNuxtModule<ModuleOptions>({
addPlugin(resolve(runtimeDir, 'plugins', 'supabase.server'))

//Add route middleware plugin for redirect
if (options.redirect) {
if (nuxt.options.runtimeConfig.public.supabase.redirect) {
addPlugin(resolve(runtimeDir, 'plugins', 'auth-redirect'))
}

Expand Down

0 comments on commit c4e30bf

Please sign in to comment.