From ec6c93b08259336810f3f559f29ad25dc9f13f83 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Jan 2021 11:40:13 +0900 Subject: [PATCH] wip --- src/client/pages/api-console.vue | 2 +- src/client/pages/api-docs/index.vue | 48 +++++++++++++++++++++------ src/server/api/endpoints/endpoints.ts | 5 ++- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/client/pages/api-console.vue b/src/client/pages/api-console.vue index dd5cacaee..1d2012b5d 100644 --- a/src/client/pages/api-console.vue +++ b/src/client/pages/api-console.vue @@ -58,7 +58,7 @@ export default defineComponent({ created() { os.api('endpoints').then(endpoints => { - this.endpoints = endpoints; + this.endpoints = endpoints.map(x => x.name); }); }, diff --git a/src/client/pages/api-docs/index.vue b/src/client/pages/api-docs/index.vue index b79299de8..f47c8fc97 100644 --- a/src/client/pages/api-docs/index.vue +++ b/src/client/pages/api-docs/index.vue @@ -1,14 +1,16 @@ @@ -26,6 +28,7 @@ export default defineComponent({ icon: faQuestionCircle }, endpoints: [], + tags: [], faQuestionCircle } }, @@ -33,7 +36,32 @@ export default defineComponent({ created() { os.api('endpoints').then(endpoints => { this.endpoints = endpoints; + + const tags = new Set(); + for (const endpoint of this.endpoints) { + if (endpoint.tags) { + for (const tag of endpoint.tags) { + tags.add(tag); + } + } + } + + this.tags = Array.from(tags); }); }, }); + + diff --git a/src/server/api/endpoints/endpoints.ts b/src/server/api/endpoints/endpoints.ts index 3ab14389a..e42d73935 100644 --- a/src/server/api/endpoints/endpoints.ts +++ b/src/server/api/endpoints/endpoints.ts @@ -11,5 +11,8 @@ export const meta = { }; export default define(meta, async () => { - return endpoints.map(x => x.name); + return endpoints.map(x => ({ + name: x.name, + tags: x.meta.tags, + })); });