Files
frontend/src/services/channelService.ts
lafay 126e204592
Some checks failed
Frontend CI / build-and-push-web (push) Successful in 2m48s
Frontend CI / ota-android (push) Successful in 11m3s
Frontend CI / build-android-apk (push) Has been cancelled
refactor(Post, PostMapper, PostRepository, CreatePostScreen, HomeScreen): update communityId to channelId for improved clarity
- Renamed communityId to channelId across Post entity, PostMapper, and PostRepository for consistency and clarity.
- Updated CreatePostScreen to include channel selection functionality, enhancing user experience when creating posts.
- Adjusted HomeScreen to support filtering posts by channel, improving content organization.
- Refactored related interfaces and services to align with the new channelId terminology, ensuring a cohesive codebase.
2026-03-24 22:27:33 +08:00

30 lines
585 B
TypeScript

import { api } from './api';
export interface ChannelItem {
id: string;
name: string;
slug: string;
description?: string;
sort_order: number;
is_active: boolean;
}
interface ChannelListResponse {
list: ChannelItem[];
}
class ChannelService {
async list(): Promise<ChannelItem[]> {
try {
const res = await api.get<ChannelListResponse>('/channels');
return res.data?.list || [];
} catch (error) {
console.error('[channelService] 获取频道失败:', error);
return [];
}
}
}
export const channelService = new ChannelService();