fixed centering issue with radius.
Signed-off-by: boris <boris@borishub.co.uk>
This commit is contained in:
@@ -272,8 +272,8 @@ function isAdmin() {
|
||||
console.log('Checking admin status...');
|
||||
|
||||
// Check if auth service is available and has user data
|
||||
if (simpleAuth && simpleAuth.getUser()) {
|
||||
const authUser = simpleAuth.getUser();
|
||||
if (auth && auth.getUser()) {
|
||||
const authUser = auth.getUser();
|
||||
console.log('Auth service user data:', authUser);
|
||||
console.log('Auth service accessLevel:', authUser.accessLevel);
|
||||
console.log('Auth service isAdmin check:', authUser.accessLevel === 1 || authUser.accessLevel === 0);
|
||||
@@ -302,8 +302,8 @@ function isAdmin() {
|
||||
*/
|
||||
function isAuthenticated() {
|
||||
// Check if auth service is available
|
||||
if (simpleAuth) {
|
||||
return simpleAuth.isAuthenticated();
|
||||
if (auth) {
|
||||
return auth.isAuthenticated();
|
||||
}
|
||||
|
||||
// Fallback to localStorage
|
||||
@@ -497,8 +497,8 @@ function setupFormHandlers() {
|
||||
// Set the action to 'create'
|
||||
formData.set('action', 'create');
|
||||
try {
|
||||
// Use simpleAuth.fetchAuth for authenticated requests
|
||||
const response = await simpleAuth.fetchAuth('/facilitycontroller.php', {
|
||||
// Use auth.fetchAuth for authenticated requests
|
||||
const response = await auth.fetchAuth('/facilitycontroller.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
@@ -605,8 +605,8 @@ function setupFormHandlers() {
|
||||
}
|
||||
|
||||
try {
|
||||
// Use simpleAuth.fetchAuth for authenticated requests
|
||||
const response = await simpleAuth.fetchAuth('/facilitycontroller.php', {
|
||||
// Use auth.fetchAuth for authenticated requests
|
||||
const response = await auth.fetchAuth('/facilitycontroller.php', {
|
||||
method: 'POST',
|
||||
body: serverFormData
|
||||
});
|
||||
@@ -694,19 +694,19 @@ function setupFormHandlers() {
|
||||
|
||||
try {
|
||||
// Check if token is valid
|
||||
if (!simpleAuth) {
|
||||
if (!auth) {
|
||||
throw new Error('Auth service not available');
|
||||
}
|
||||
|
||||
// Validate token with server before proceeding
|
||||
console.log('Validating token with server...');
|
||||
const isValid = await simpleAuth.validateToken();
|
||||
const isValid = await auth.validateToken();
|
||||
if (!isValid) {
|
||||
throw new Error('Authentication token is invalid or expired');
|
||||
}
|
||||
|
||||
// Get token after validation to ensure it's fresh
|
||||
const token = simpleAuth.getToken();
|
||||
const token = auth.getToken();
|
||||
console.log('Using token for delete request:', token);
|
||||
|
||||
if (!token) {
|
||||
@@ -714,16 +714,16 @@ function setupFormHandlers() {
|
||||
}
|
||||
|
||||
// Decode token to check payload
|
||||
if (simpleAuth.parseJwt) {
|
||||
const payload = simpleAuth.parseJwt(token);
|
||||
if (auth.parseJwt) {
|
||||
const payload = auth.parseJwt(token);
|
||||
console.log('Token payload:', payload);
|
||||
console.log('Access level:', payload.accessLevel);
|
||||
console.log('Is admin check:', payload.accessLevel === 0 || payload.accessLevel === 1);
|
||||
}
|
||||
|
||||
// Use simpleAuth.fetchAuth for authenticated requests
|
||||
// Use auth.fetchAuth for authenticated requests
|
||||
console.log('Sending delete request to server...');
|
||||
const response = await simpleAuth.fetchAuth('/facilitycontroller.php', {
|
||||
const response = await auth.fetchAuth('/facilitycontroller.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
|
Reference in New Issue
Block a user