Skip to content

Commit

Permalink
feat(module): add admin option to config (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
Striffly authored Dec 5, 2023
1 parent 029811d commit f56a1a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/content/2.setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Defaults:
{
url: process.env.STRAPI_URL || 'http://localhost:1337',
prefix: '/api',
admin: '/admin',
version: 'v4',
cookie: {},
cookieName: 'strapi_jwt'
Expand Down Expand Up @@ -73,6 +74,10 @@ URL of the Strapi server.

Environment variable `STRAPI_URL` can be used to override `url`.

### `admin`

Specify admin prefix used by your Strapi.

### `prefix`

Prefix of the Strapi server. Only used when version is `v4`.
Expand Down
10 changes: 9 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ export interface ModuleOptions {
*/
prefix?: string

/**
* Strapi Admin Prefix
* @default '/admin'
* @type string
*/
admin?: string;

/**
* Strapi Version
* @default 'v4'
Expand Down Expand Up @@ -76,6 +83,7 @@ export default defineNuxtModule<ModuleOptions>({
defaults: {
url: process.env.STRAPI_URL || 'http://localhost:1337',
prefix: '/api',
admin: '/admin',
version: 'v4',
cookie: {},
auth: {},
Expand Down Expand Up @@ -107,7 +115,7 @@ export default defineNuxtModule<ModuleOptions>({
config.optimizeDeps.include.push('qs')
})

const adminUrl = joinURL(nuxt.options.runtimeConfig.public.strapi.url, '/admin/')
const adminUrl = joinURL(nuxt.options.runtimeConfig.public.strapi.url, nuxt.options.runtimeConfig.public.strapi.admin)
logger.info(`Strapi Admin URL: ${adminUrl}`)
if (options.devtools) {
nuxt.hook('devtools:customTabs', (iframeTabs) => {
Expand Down

0 comments on commit f56a1a9

Please sign in to comment.