databag/app/mobile/src/api/setContactChannelTopicSubject.js

12 lines
526 B
JavaScript
Raw Normal View History

2022-09-07 07:32:06 +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-09-29 18:31:55 +00:00
let channel = await fetchWithTimeout(`https://${server}/content/channels/${channelId}/topics/${topicId}/subject?contact=${token}&confirm=true`,
2022-09-07 07:32:06 +00:00
{ method: 'PUT', body: JSON.stringify(subject) });
checkResponse(channel);
}