@zencemarketing/web-sdk
Version:
ZenceMarketing Web SDK for push notifications, popups, and custom event tracking.
13 lines (12 loc) • 383 B
JavaScript
import CONFIG from "./config.js";
async function apiRequest(endpoint, method = "GET", data = null) {
const response = await fetch(`${CONFIG.API_BASE_URL}/${endpoint}`, {
method,
headers: {
"Content-Type": "application/json",
},
body: data ? JSON.stringify(data) : null,
});
return response.json();
}
export default apiRequest;