jl-datatable
Version:
A datatable server side rendering mode - Vue JS 3 ⚙️
21 lines (19 loc) • 607 B
JavaScript
export default function (endpoint, options = {}){
const sendRequest = async() => {
try{
if(Object.keys(options).length === 0){
options = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
};
}
const request = await fetch(endpoint, options);
return await request.json();
}catch(e){
throw e;
}
}
return { sendRequest };
}