You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
684 B
33 lines
684 B
|
|
|
|
const API_SERVER = "/API";
|
|
|
|
|
|
async function API_GET_TEXT(target) {
|
|
try {
|
|
const response = await fetch(API_SERVER + target, {
|
|
method: 'GET',
|
|
headers: {
|
|
},
|
|
credentials: 'include',
|
|
});
|
|
return await response.text();
|
|
} catch (error) {
|
|
return {error: error.message};
|
|
}
|
|
}
|
|
|
|
|
|
async function API_GET(target) {
|
|
try {
|
|
const response = await fetch(API_SERVER + target, {
|
|
method: 'GET',
|
|
headers: {
|
|
},
|
|
credentials: 'include',
|
|
});
|
|
return await response.json();
|
|
} catch (error) {
|
|
return {error: error.message};
|
|
}
|
|
}
|
|
|