fix channel about response type

This commit is contained in:
Simon 2025-02-21 23:17:19 +07:00
parent 83cfa03e11
commit 60724df45a
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
3 changed files with 16 additions and 19 deletions

View File

@ -1,6 +1,7 @@
import APIClient from '../../functions/APIClient';
import { ChannelResponseType } from '../../pages/ChannelBase';
const loadChannelById = async (youtubeChannelId: string) => {
const loadChannelById = async (youtubeChannelId: string): Promise<ChannelResponseType> => {
return APIClient(`/api/channel/${youtubeChannelId}/`);
};

View File

@ -63,20 +63,16 @@ const ChannelAbout = () => {
const channelResponse = await loadChannelById(channelId);
setChannelResponse(channelResponse);
setDownloadFormat(channelResponse?.data?.channel_overwrites?.download_format ?? null);
setAutoDeleteAfter(channelResponse?.data?.channel_overwrites?.autodelete_days ?? null);
setIndexPlaylists(channelResponse?.data?.channel_overwrites?.index_playlists ?? null);
setEnableSponsorblock(
channelResponse?.data?.channel_overwrites?.integrate_sponsorblock ?? null,
);
setPageSizeVideo(
channelResponse?.data?.channel_overwrites?.subscriptions_channel_size ?? null,
);
setDownloadFormat(channelResponse?.channel_overwrites?.download_format ?? null);
setAutoDeleteAfter(channelResponse?.channel_overwrites?.autodelete_days ?? null);
setIndexPlaylists(channelResponse?.channel_overwrites?.index_playlists ?? false);
setEnableSponsorblock(channelResponse?.channel_overwrites?.integrate_sponsorblock ?? null);
setPageSizeVideo(channelResponse?.channel_overwrites?.subscriptions_channel_size ?? null);
setPageSizeShorts(
channelResponse?.data?.channel_overwrites?.subscriptions_shorts_channel_size ?? null,
channelResponse?.channel_overwrites?.subscriptions_shorts_channel_size ?? null,
);
setPageSizeStreams(
channelResponse?.data?.channel_overwrites?.subscriptions_live_channel_size ?? null,
channelResponse?.channel_overwrites?.subscriptions_live_channel_size ?? null,
);
setRefresh(false);

View File

@ -17,13 +17,13 @@ import { useUserConfigStore } from '../stores/UserConfigStore';
import updateUserConfig, { UserConfigType } from '../api/actions/updateUserConfig';
type ChannelOverwritesType = {
download_format?: string;
autodelete_days?: number;
index_playlists?: boolean;
integrate_sponsorblock?: boolean | null;
subscriptions_channel_size?: number;
subscriptions_live_channel_size?: number;
subscriptions_shorts_channel_size?: number;
download_format: string | null;
autodelete_days: number | null;
index_playlists: boolean | null;
integrate_sponsorblock: boolean | null;
subscriptions_channel_size: number | null;
subscriptions_live_channel_size: number | null;
subscriptions_shorts_channel_size: number | null;
};
export type ChannelType = {