fix(admin): resolve GET/PUT /admin/settings 404, videos.map crash, and remove legacy CMS sidebar link
Some checks failed
Deploy Canina / deploy (push) Failing after 29s
Some checks failed
Deploy Canina / deploy (push) Failing after 29s
This commit is contained in:
parent
df340143dc
commit
43cf55a8ef
@ -228,4 +228,18 @@ export class AdminController {
|
||||
await this.adminService.deleteDoctor(id);
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
@Get('settings')
|
||||
@ApiOperation({ summary: 'دریافت تنظیمات کلی سیستم' })
|
||||
async getSettings() {
|
||||
const data = await this.adminService.getSettings();
|
||||
return { success: true, data };
|
||||
}
|
||||
|
||||
@Put('settings')
|
||||
@ApiOperation({ summary: 'بروزرسانی تنظیمات کلی سیستم' })
|
||||
async updateSettings(@Body() body: Record<string, string>) {
|
||||
const data = await this.adminService.updateSettings(body);
|
||||
return { success: true, data };
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,6 @@ const menuGroups = [
|
||||
{ icon: FileText, label: 'وبلاگ', path: '/blogs' },
|
||||
{ icon: BookOpen, label: 'دانشنامه عمومی', path: '/wiki' },
|
||||
{ icon: Video, label: 'مدیریت ویدئوها', path: '/videos' },
|
||||
{ icon: Image, label: 'مدیریت CMS قدیم', path: '/cms' },
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -45,9 +45,22 @@ export default function Videos() {
|
||||
api.get('/videos', {
|
||||
params: { search: searchTerm, limit: 100 },
|
||||
}).then(res => {
|
||||
if (isSubscribed) setVideos(res.data.data || res.data || []);
|
||||
if (isSubscribed) {
|
||||
const raw = res.data;
|
||||
const videoList = Array.isArray(raw?.videos)
|
||||
? raw.videos
|
||||
: Array.isArray(raw?.data?.videos)
|
||||
? raw.data.videos
|
||||
: Array.isArray(raw?.data)
|
||||
? raw.data
|
||||
: Array.isArray(raw)
|
||||
? raw
|
||||
: [];
|
||||
setVideos(videoList);
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('Failed to fetch videos:', err);
|
||||
if (isSubscribed) setVideos([]);
|
||||
}).finally(() => {
|
||||
if (isSubscribed) setIsLoading(false);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user