35 lines
614 B
Vue
35 lines
614 B
Vue
<script>
|
|
fetchData();
|
|
|
|
function fetchData() {
|
|
const api = "/api/query";
|
|
|
|
const username = import.meta.env.VITE_USERNAME;
|
|
const password = "Ap&216991";
|
|
|
|
const token = btoa(`${username}:${password}`);
|
|
|
|
const headers = {
|
|
Authorization: `Basic ${token}`,
|
|
};
|
|
|
|
const request = {
|
|
method: "post",
|
|
body: JSON.stringify({
|
|
query: "site.title",
|
|
}),
|
|
headers,
|
|
};
|
|
|
|
fetch(api, request)
|
|
.then((response) => response.json())
|
|
.then((response) => {
|
|
console.log(response);
|
|
})
|
|
.catch((error) => {
|
|
console.log(error);
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<template>test</template>
|