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