mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +00:00
12 lines
492 B
JavaScript
12 lines
492 B
JavaScript
import { checkResponse, fetchWithTimeout } from './fetchUtil';
|
|
|
|
export async function setChannelTopicSubject(token, channelId, topicId, data) {
|
|
let subject = { data: JSON.stringify(data, (key, value) => {
|
|
if (value !== null) return value
|
|
}), datatype: 'superbasictopic' };
|
|
|
|
let channel = await fetchWithTimeout(`/content/channels/${channelId}/topics/${topicId}/subject?agent=${token}&confirm=true`,
|
|
{ method: 'PUT', body: JSON.stringify(subject) });
|
|
checkResponse(channel);
|
|
}
|