databag/app/mobile/api/getContactChannels.js

21 lines
580 B
JavaScript
Raw Normal View History

2022-09-07 07:32:06 +00:00
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function getContactChannels(server, token, viewRevision, channelRevision) {
let host = "";
if (server) {
host = `https://${server}`;
}
let param = "?contact=" + token
if (viewRevision != null) {
param += '&viewRevision=' + viewRevision
}
if (channelRevision != null) {
param += '&channelRevision=' + channelRevision
}
let channels = await fetchWithTimeout(`${host}/content/channels${param}`, { method: 'GET' });
checkResponse(channels)
return await channels.json()
}