@cometchat/chat-uikit-react-native
Version:
Ready-to-use Chat UI Components for React Native
28 lines • 757 B
JavaScript
export class CometChatNetworkUtils {
static async fetcher({ url, method, body, headers, }) {
try {
const res = await fetch(url, {
method: method,
body: JSON.stringify(body),
headers: {
"Content-Type": "application/json",
...headers,
},
});
const json = await res.json();
return res;
}
catch (error) {
throw error;
}
}
}
export function isHttpUrl(string) {
if (String(string).startsWith("https://") || String(string).startsWith("http://")) {
return true;
}
else {
return false;
}
}
//# sourceMappingURL=NetworkUtils.js.map