databag/net/web/src/api/setContactChannelTopicSubject.js

12 lines
527 B
JavaScript
Raw Normal View History

2022-05-27 06:57:16 +00:00
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function setContactChannelTopicSubject(server, token, channelId, topicId, data) {
let subject = { data: JSON.stringify(data, (key, value) => {
if (value !== null) return value
}), datatype: 'superbasictopic' };
2022-07-20 20:54:22 +00:00
let channel = await fetchWithTimeout(`https://${server}//content/channels/${channelId}/topics/${topicId}/subject?contact=${token}&confirm=true`,
2022-05-27 06:57:16 +00:00
{ method: 'PUT', body: JSON.stringify(subject) });
checkResponse(channel);
}