Update API endpoints and navigation paths in admin templates
This commit is contained in:
@@ -98,7 +98,7 @@ async function sendAction(action) {
|
|||||||
if (!currentMedia?.id) return;
|
if (!currentMedia?.id) return;
|
||||||
|
|
||||||
const token = getToken();
|
const token = getToken();
|
||||||
const endpoint = `admin/api/${action}`;
|
const endpoint = `api/${action}`;
|
||||||
await fetch(endpoint, {
|
await fetch(endpoint, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -130,7 +130,7 @@ function showMessage(text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function fetchMedia(token) {
|
async function fetchMedia(token) {
|
||||||
const res = await fetch('admin/api/getmedia', {
|
const res = await fetch('api/getmedia', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: { 'Authorization': 'Bearer ' + token }
|
headers: { 'Authorization': 'Bearer ' + token }
|
||||||
});
|
});
|
||||||
|
@@ -70,7 +70,7 @@ function login() {
|
|||||||
document.getElementById('message').innerText = data.message;
|
document.getElementById('message').innerText = data.message;
|
||||||
saveToken(data.token);
|
saveToken(data.token);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = "index.html";
|
window.location.href = "/";
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('message').innerText = "Login failed.";
|
document.getElementById('message').innerText = "Login failed.";
|
||||||
|
Reference in New Issue
Block a user