From b21287262e85e3e09e19217ba4168b83e4fdf4a7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 24 Aug 2018 07:23:04 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=81=E3=83=A3=E3=83=BC=E3=83=88=E5=8F=96?= =?UTF-8?q?=E5=BE=97API=E3=82=92=E8=AA=B0=E3=81=A7=E3=82=82=E5=88=A9?= =?UTF-8?q?=E7=94=A8=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=AA=E3=81=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/desktop/views/pages/admin/admin.chart.vue | 11 ++++++----- src/client/app/desktop/views/pages/admin/admin.vue | 7 +------ src/server/api/endpoints/{admin => }/chart.ts | 4 +--- 3 files changed, 8 insertions(+), 14 deletions(-) rename src/server/api/endpoints/{admin => }/chart.ts (95%) diff --git a/src/client/app/desktop/views/pages/admin/admin.chart.vue b/src/client/app/desktop/views/pages/admin/admin.chart.vue index f40f89b2e0..b02f6c31b7 100644 --- a/src/client/app/desktop/views/pages/admin/admin.chart.vue +++ b/src/client/app/desktop/views/pages/admin/admin.chart.vue @@ -44,13 +44,9 @@ export default Vue.extend({ components: { XChart }, - props: { - chart: { - required: true - } - }, data() { return { + chart: null, chartType: 'local-notes', span: 'hour' }; @@ -85,6 +81,11 @@ export default Vue.extend({ ); } }, + created() { + (this as any).api('chart').then(chart => { + this.chart = chart; + }); + }, methods: { notesChart(local: boolean): any { const data = this.stats.slice().reverse().map(x => ({ diff --git a/src/client/app/desktop/views/pages/admin/admin.vue b/src/client/app/desktop/views/pages/admin/admin.vue index 066c1a4f4f..0bb5ed0a0f 100644 --- a/src/client/app/desktop/views/pages/admin/admin.vue +++ b/src/client/app/desktop/views/pages/admin/admin.vue @@ -11,7 +11,7 @@
- +
@@ -49,11 +49,6 @@ export default Vue.extend({ chart: null }; }, - created() { - (this as any).api('admin/chart').then(chart => { - this.chart = chart; - }); - }, methods: { nav(page: string) { this.page = page; diff --git a/src/server/api/endpoints/admin/chart.ts b/src/server/api/endpoints/chart.ts similarity index 95% rename from src/server/api/endpoints/admin/chart.ts rename to src/server/api/endpoints/chart.ts index 1b88af00bd..a58f0b163e 100644 --- a/src/server/api/endpoints/admin/chart.ts +++ b/src/server/api/endpoints/chart.ts @@ -1,10 +1,8 @@ -import Stats, { IStats } from '../../../../models/stats'; +import Stats, { IStats } from '../../../models/stats'; type Omit = Pick>; export const meta = { - requireCredential: true, - requireAdmin: true }; export default (params: any) => new Promise(async (res, rej) => {