Skip to content

Commit ee5161a

Browse files
committed
refactor: define base url for each api routes
1 parent 7d62434 commit ee5161a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/module.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ export default defineNuxtModule<ModuleOptions>({
6060
})
6161

6262
const apiDir = resolve(runtimeDir, 'server', 'api', 'notion')
63+
const apiBase = options.apiBase
6364

6465
// Blocks paths
65-
const blockRoute = `${options.apiBase}/blocks/:id`
66+
const blockRoute = `${apiBase}/blocks/:id`
6667
const blocksDir = resolve(apiDir, 'blocks')
6768

6869
addServerHandler({
@@ -87,7 +88,7 @@ export default defineNuxtModule<ModuleOptions>({
8788
})
8889

8990
// Page paths
90-
const pagesRoute = `${options.apiBase}/pages/:id`
91+
const pagesRoute = `${apiBase}/pages/:id`
9192
const pagesDir = resolve(apiDir, 'pages')
9293

9394
addServerHandler({
@@ -104,7 +105,7 @@ export default defineNuxtModule<ModuleOptions>({
104105
})
105106

106107
// Users paths
107-
const usersRoute = `${options.apiBase}/users`
108+
const usersRoute = `${apiBase}/users`
108109
const usersDir = resolve(apiDir, 'users')
109110

110111
addServerHandler({
@@ -117,7 +118,7 @@ export default defineNuxtModule<ModuleOptions>({
117118
})
118119

119120
// Search paths
120-
const searchRoute = `${options.apiBase}/search`
121+
const searchRoute = `${apiBase}/search`
121122
const searchDir = resolve(apiDir, 'search')
122123

123124
addServerHandler({
@@ -126,7 +127,7 @@ export default defineNuxtModule<ModuleOptions>({
126127
})
127128

128129
// Databases paths
129-
const databasesRoute = `${options.apiBase}/databases/:id`
130+
const databasesRoute = `${apiBase}/databases/:id`
130131
const databasesDir = resolve(apiDir, 'databases')
131132

132133
addServerHandler({

0 commit comments

Comments
 (0)