mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-05-06 06:00:44 +08:00
refactor(channels): tighten types and error paths per second review
- service: drop groupRepo nil guard (DI must inject), switch SupportedModels to SliceStable to match doc - frontend: reuse user-side DTO types in SupportedModelChip/AvailableChannelsTable instead of duplicating shapes; narrow admin statusLabel param to ChannelStatus - tests: replace nil-groupRepo case with ListAll/ListActive error propagation and BillingModelSource default-backfill coverage
This commit is contained in:
@@ -78,7 +78,7 @@ import AvailableChannelsTable from '@/components/channels/AvailableChannelsTable
|
||||
import channelsAPI, { type AvailableChannel } from '@/api/admin/channels'
|
||||
import { useAppStore } from '@/stores/app'
|
||||
import { extractApiErrorMessage } from '@/utils/apiError'
|
||||
import { CHANNEL_STATUS_ACTIVE } from '@/constants/channel'
|
||||
import { CHANNEL_STATUS_ACTIVE, type ChannelStatus } from '@/constants/channel'
|
||||
|
||||
const { t } = useI18n()
|
||||
const appStore = useAppStore()
|
||||
@@ -95,7 +95,7 @@ const columns = computed(() => [
|
||||
{ key: 'supported_models', label: t('admin.availableChannels.columns.supportedModels') }
|
||||
])
|
||||
|
||||
function statusLabel(status: string): string {
|
||||
function statusLabel(status: ChannelStatus): string {
|
||||
return status === CHANNEL_STATUS_ACTIVE
|
||||
? t('admin.availableChannels.statusActive')
|
||||
: t('admin.availableChannels.statusDisabled')
|
||||
|
||||
Reference in New Issue
Block a user