Custom channel emoticons WIP (#130)

This commit is contained in:
John Livingston
2024-05-28 17:56:24 +02:00
parent 6713192719
commit dad29a941f
15 changed files with 341 additions and 31 deletions

View File

@ -4,7 +4,9 @@
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
import type { ValidationError } from '../../lib/models/validation'
import type { ChannelLiveChatInfos, ChannelConfiguration, ChannelConfigurationOptions } from 'shared/lib/types'
import type {
ChannelLiveChatInfos, ChannelConfiguration, ChannelConfigurationOptions, ChannelEmojis
} from 'shared/lib/types'
import { ValidationErrorType } from '../../lib/models/validation'
import { getBaseRoute } from '../../../utils/uri'
@ -158,4 +160,22 @@ export class ChannelDetailsService {
return response.json()
}
fetchEmojis = async (channelId: number): Promise<ChannelEmojis> => {
const response = await fetch(
getBaseRoute(this._registerClientOptions) +
'/api/configuration/channel/emojis/' +
encodeURIComponent(channelId),
{
method: 'GET',
headers: this._headers
}
)
if (!response.ok) {
throw new Error('Can\'t get channel emojis options.')
}
return response.json()
}
}