Skip to content

Commit

Permalink
feat: add option for enable of cookie plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Klesse committed Sep 6, 2024
1 parent c76aa10 commit fb3336a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion playground/nuxt-app/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default defineNuxtConfig({
generateTypes: process.env['GENERATE_TYPES'] === '1',
gqlHost: 'http://localhost:3000/graphql',
host: 'http://localhost:3000',
registerAuthPlugins: true,
schema: '../server/schema.gql',
storagePrefix: 'playground',
},
Expand Down
16 changes: 8 additions & 8 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ModuleOptions {
gqlHost: string;
host: string;
registerAuthPlugins?: boolean;
registerPlugins?: boolean;
registerCookiePlugin?: boolean;
schema?: string;
storagePrefix?: string;
}
Expand Down Expand Up @@ -42,7 +42,7 @@ export default defineNuxtModule<ModuleOptions>({
gqlHost: '',
host: '',
registerAuthPlugins: false,
registerPlugins: true,
registerCookiePlugin: true,
schema: undefined,
storagePrefix: 'base',
},
Expand All @@ -66,16 +66,16 @@ export default defineNuxtModule<ModuleOptions>({
nuxt.options.runtimeConfig.public['schema'] = options.schema ?? null;
nuxt.options.runtimeConfig.public['storagePrefix'] = options.storagePrefix ?? null;

if (options.registerPlugins) {
if (options.registerCookiePlugin) {
addPlugin(resolver.resolve('runtime/plugins/cookies'));
}

if (!options.disableGraphql) {
addPlugin(resolver.resolve('runtime/plugins/graphql-meta'));
addPlugin(resolver.resolve('runtime/plugins/ws.client'));
}
if (!options.disableGraphql) {
addPlugin(resolver.resolve('runtime/plugins/graphql-meta'));
addPlugin(resolver.resolve('runtime/plugins/ws.client'));
}

if (options.registerAuthPlugins && options.registerPlugins) {
if (options.registerAuthPlugins) {
addPlugin(resolver.resolve('runtime/plugins/auth.server'));
}

Expand Down

0 comments on commit fb3336a

Please sign in to comment.