From b15f293b82a7f3524f89d53d4e6373e219e7865f Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 22 Nov 2023 18:46:27 +0900 Subject: [PATCH] fix lint, resolve code smell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com> --- .../src/server/api/endpoints/admin/ad/list.ts | 2 +- packages/frontend/src/pages/admin/ads.vue | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/admin/ad/list.ts b/packages/backend/src/server/api/endpoints/admin/ad/list.ts index 1366fbf76..8cdeaae17 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/list.ts @@ -22,7 +22,7 @@ export const paramDef = { limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, sinceId: { type: 'string', format: 'misskey:id' }, untilId: { type: 'string', format: 'misskey:id' }, - publishing: { type: 'boolean', default: null, nullable: true}, + publishing: { type: 'boolean', default: null, nullable: true }, }, required: [], } as const; diff --git a/packages/frontend/src/pages/admin/ads.vue b/packages/frontend/src/pages/admin/ads.vue index 1ce99d4ba..1c15e3255 100644 --- a/packages/frontend/src/pages/admin/ads.vue +++ b/packages/frontend/src/pages/admin/ads.vue @@ -9,11 +9,11 @@ SPDX-License-Identifier: AGPL-3.0-only - + - - - + + +
@@ -104,8 +104,8 @@ let ads: any[] = $ref([]); const localTime = new Date(); const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000; const daysOfWeek: string[] = [i18n.ts._weekday.sunday, i18n.ts._weekday.monday, i18n.ts._weekday.tuesday, i18n.ts._weekday.wednesday, i18n.ts._weekday.thursday, i18n.ts._weekday.friday, i18n.ts._weekday.saturday]; +const filterType = ref('all'); let publishing: boolean | null = null; -let type = ref('null'); os.api('admin/ad/list', { publishing: publishing }).then(adsResponse => { if (adsResponse != null) { @@ -123,9 +123,15 @@ os.api('admin/ad/list', { publishing: publishing }).then(adsResponse => { } }); -const onChangePublishing = (v) => { - console.log(v); - publishing = v === 'true' ? true : v === 'false' ? false : null; +const filterItems = (v) => { + if (v === 'publishing') { + publishing = true; + } else if (v === 'expired') { + publishing = false; + } else { + publishing = null; + } + refresh(); };