+ _genMyHTML(bazaarType: TBazaarType) {
+ let url = "/api/bazaar/getInstalledTheme";
+ if (bazaarType === "icons") {
+ url = "/api/bazaar/getInstalledTheme";
+ } else if (bazaarType === "widgets") {
+ url = "/api/bazaar/getInstalledWidgets";
+ }else if (bazaarType === "templates") {
+ url = "/api/bazaar/getInstalledTemplates";
+ }
+ fetchPost(url, {}, response => {
+ let html = "";
+ response.data.packages.forEach((item: IBazaarItem) => {
+ html += `
${item.name}
@@ -180,21 +191,25 @@ export const bazaar = {
${item.downloads}
-
-
+
+
+
+
-
-
-
+
+
+
+
+
`;
+ });
+ bazaar.data.downloaded = response.data.packages;
+ bazaar.element.querySelector("#configBazaarDownloaded").innerHTML = `
${html}
`;
+ });
},
data: {
themes: [] as IBazaarItem[],
@@ -312,14 +327,7 @@ export const bazaar = {
}
})
target.classList.remove("b3-button--outline");
- fetchPost(`/api/bazaar/getInstalled${type.replace("my", "")}`, {}, response => {
- let html = "";
- response.data.packages.forEach((item: IBazaarItem) => {
- html += this._genMyHTML(item, type.replace("my", "").toLowerCase() + "s" as TBazaarType);
- });
- bazaar.data.downloaded = response.data.packages;
- bazaar.element.querySelector("#configBazaarDownloaded").innerHTML = `
${html}
`;
- });
+ this._genMyHTML(type.replace("my", "").toLowerCase() + "s" as TBazaarType);
event.preventDefault();
event.stopPropagation();
break;
@@ -423,7 +431,11 @@ export const bazaar = {
fetchPost(url, {
packageName
}, response => {
- bazaar.onBazaar(response, bazaarType, ["themes", "icons"].includes(bazaarType));
+ if (cardElement && cardElement.getAttribute("data-type") === "downloaded") {
+ this._genMyHTML(bazaarType);
+ } else {
+ bazaar.onBazaar(response, bazaarType, ["themes", "icons"].includes(bazaarType));
+ }
});
}
event.preventDefault();
@@ -516,14 +528,7 @@ export const bazaar = {
bazaar.data.widgets = response.data.packages;
});
} else if (type === "downloaded") {
- fetchPost("/api/bazaar/getInstalledTheme", {}, response => {
- let html = "";
- response.data.packages.forEach((item: IBazaarItem) => {
- html += this._genMyHTML(item, "themes");
- });
- bazaar.data.downloaded = response.data.packages;
- bazaar.element.querySelector("#configBazaarDownloaded").innerHTML = `
${html}
`;
- });
+ this._genMyHTML("themes");
}
item.setAttribute("data-init", "true");
}