Оптимизировать запрос медиа

This commit is contained in:
ifraimka committed 2024-04-19 20:35:15 +03:00
1 parent cf524e95ce
commit 39c6ce0d57
5 files changed
+32 -35

No files matched your search

+11 -1
View File
@@ -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);