as
This commit is contained in:
@@ -6,7 +6,7 @@ async function ensureAuthenticated() {
|
|||||||
try {
|
try {
|
||||||
const me = await apiAction('auth.me', { method: 'GET' });
|
const me = await apiAction('auth.me', { method: 'GET' });
|
||||||
if (!me?.ok || !me?.user) {
|
if (!me?.ok || !me?.user) {
|
||||||
// window.location.href = '/login.php';
|
window.location.href = '/login.php';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
window.__currentUser = me.user;
|
window.__currentUser = me.user;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ async function apiFetch(url, init = {}) {
|
|||||||
});
|
});
|
||||||
if (res.status === 401) {
|
if (res.status === 401) {
|
||||||
if (!disableAuthRedirect) {
|
if (!disableAuthRedirect) {
|
||||||
//window.location.href = "/login.php";
|
window.location.href = "/login.php";
|
||||||
}
|
}
|
||||||
throw new Error("unauthorized");
|
throw new Error("unauthorized");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ async function ensureAuthenticated() {
|
|||||||
try {
|
try {
|
||||||
const me = await apiAction('auth.me', { method: 'GET' });
|
const me = await apiAction('auth.me', { method: 'GET' });
|
||||||
if (!me?.ok || !me?.user) {
|
if (!me?.ok || !me?.user) {
|
||||||
// window.location.href = '/login.php';
|
window.location.href = '/login.php';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
window.__currentUser = me.user;
|
window.__currentUser = me.user;
|
||||||
|
|||||||
Reference in New Issue
Block a user