fix: applyRoleRestrictions was called but never defined — was causing Error loading request
This commit is contained in:
parent
0e11ba2ba1
commit
e197bb9526
Binary file not shown.
Binary file not shown.
|
|
@ -134,6 +134,26 @@
|
||||||
let currentData = null;
|
let currentData = null;
|
||||||
let currentAnswers = [];
|
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() {
|
async function loadAll() {
|
||||||
try {
|
try {
|
||||||
const res = await fetchAPI('/api/requests/' + reqID);
|
const res = await fetchAPI('/api/requests/' + reqID);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue