Skip to content

Commit 2fd0445

Browse files
committed
refactor: rename the router controller to 'findOne' for fetching with a read-only API token
1 parent 0625149 commit 2fd0445

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

.changeset/hungry-planes-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"strapi-plugin-webtools": major
3+
---
4+
5+
refactor: rename the router controller to 'findOne' for fetching with a read-only API token
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import urlAliasController from './url-alias';
22
import urlPatternController from './url-pattern';
33
import infoController from './info';
4-
import coreController from './core';
4+
import routerController from './router';
55
import searchController from './search';
66

77
export default {
88
'url-alias': urlAliasController,
99
'url-pattern': urlPatternController,
1010
info: infoController,
11-
core: coreController,
11+
router: routerController,
1212
search: searchController,
1313
};

packages/core/server/controllers/core.ts renamed to packages/core/server/controllers/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { sanitizeOutput } from '../util/sanitizeOutput';
1010
*/
1111

1212
export default {
13-
router: async (ctx: Context) => {
13+
findOne: async (ctx: Context) => {
1414
const { path, ...searchQuery } = ctx.query;
1515
const { auth } = ctx.state;
1616

packages/core/server/routes/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default {
4545
{
4646
method: 'GET',
4747
path: '/router',
48-
handler: 'core.router',
48+
handler: 'router.findOne',
4949
config: {
5050
policies: [],
5151
},

playground/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export default {
3636

3737
publicRole.permissions['plugin::webtools'] = {
3838
controllers: {
39-
core: {
40-
router: { enabled: true },
39+
router: {
40+
findOne: { enabled: true },
4141
},
4242
'url-alias': {
4343
find: { enabled: true },

0 commit comments

Comments
 (0)