fix: applyRoleRestrictions was called but never defined — was causing Error loading request

This commit is contained in:
James 2026-03-12 04:51:25 -04:00
parent 0e11ba2ba1
commit e197bb9526
3 changed files with 20 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -134,6 +134,26 @@
let currentData = null;
let currentAnswers = [];
async function applyRoleRestrictions() {
try {
const res = await fetchAPI('/api/auth/me');
if (!res.ok) return;
const me = await res.json();
const role = me.test_role || '';
const isReadOnly = role === 'buyer' || role === 'seller' || role === 'advisor';
if (isReadOnly) {
const ua = document.getElementById('uploadArea');
if (ua) ua.style.display = 'none';
const mb = document.getElementById('markAnsweredBtn');
if (mb) mb.style.display = 'none';
const eb = document.getElementById('editReqBtn');
if (eb) eb.style.display = 'none';
const cc = document.getElementById('commentComposer');
if (cc) cc.style.display = 'none';
}
} catch(e) {}
}
async function loadAll() {
try {
const res = await fetchAPI('/api/requests/' + reqID);