update admin panel, api, and shared-types

This commit is contained in:
mahmood
2026-10-25 11:43:45 +03:30
parent 2134de99e2
commit 5bd77c33d3
12 changed files with 150 additions and 91 deletions
+6 -17
View File
@@ -94,13 +94,8 @@
<a-button class="mt-4" type="primary" @click="saveTags">ذخیره برچسب ها</a-button>
</a-tab-pane>
<!-- اسلایدر موبایل — دسترسی جدا از بقیه‌ی این صفحه، چون آپلود بنر عمومی
سایت حساس‌تر از ویرایش برند/برچسب است (custom.config.statics.slider) -->
<a-tab-pane
v-if="hasPermission('custom.config.statics.slider')"
key="slider"
tab="اسلایدر موبایل"
>
<!-- اسلایدر موبایل — برای هر کسی که این صفحه را می‌بیند (config.statics) -->
<a-tab-pane key="slider" tab="اسلایدر موبایل">
<div class="slider-toolbar">
<span class="slider-count">{{ sliders.length }} اسلاید</span>
<div class="row">
@@ -309,11 +304,8 @@ function removeSlide(index: number) {
sliders.value.splice(index, 1);
}
// Gated server-side by its own `custom.config.statics.slider` permission (not
// the broad `config.statics` that guards the rest of this screen) — see
// admin-misc.controller.ts. Uses the dedicated `const/slider` route rather
// than the generic `const/:key`, which the server only accepts under that
// specific permission.
// Uses the dedicated `const/slider` route: the generic `const/:key` refuses the
// slider's key (admin-misc.controller.ts).
async function saveSliders() {
try {
await api.put('const/slider', { val: sliders.value });
@@ -371,12 +363,9 @@ onMounted(async () => {
try {
loading.value = true;
await Promise.all([loadBrands(), users.isSuperAdmin ? loadCollections() : Promise.resolve()]);
const [t, s] = await Promise.all([
api.get('const/__list__tags'),
hasPermission('custom.config.statics.slider') ? api.get('const/slider') : Promise.resolve(null),
]);
const [t, s] = await Promise.all([api.get('const/__list__tags'), api.get('const/slider')]);
tags.value = Array.isArray(t.data) ? t.data : [];
sliders.value = Array.isArray(s?.data) ? s.data : [];
sliders.value = Array.isArray(s.data) ? s.data : [];
} catch (e) {
console.log(e);
} finally {