mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 03:39:45 +00:00
Оптимизировать запрос медиа
This commit is contained in:
1 parent
cf524e95ce
commit
39c6ce0d57
5 files changed
+32
-35
No files matched your search
+11
-1
@@ -58,8 +58,18 @@ export async function getPosts(q = '') {
|
||||
}
|
||||
}
|
||||
|
||||
export async function getMedia(category) {
|
||||
export async function getMedia(category, target = false) {
|
||||
try {
|
||||
if (target) {
|
||||
for (let media of mediaLibrary[category]) {
|
||||
target[media.name].image = media.image;
|
||||
target[media.name].id = media.id;
|
||||
console.log(target[media.name].id);
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
return mediaLibrary[category];
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
Reference in new issue
Block a user