separate installtheme logic

This commit is contained in:
SethBurkart123
2024-05-21 19:42:33 +10:00
parent fcfc2d4217
commit e7943fbfd3
+6 -4
View File
@@ -21,6 +21,10 @@ export const StoreDownloadTheme = async (theme: { themeContent: Theme }) => {
const themeContent = await fetch(`https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Themes/main/store/themes/${theme.themeContent.id}/theme.json`); const themeContent = await fetch(`https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Themes/main/store/themes/${theme.themeContent.id}/theme.json`);
const themeData = await themeContent.json() as ThemeContent; const themeData = await themeContent.json() as ThemeContent;
await InstallTheme(themeData);
};
export const InstallTheme = async (themeData: ThemeContent) => {
const coverImageBlob = base64ToBlob(themeData.coverImage); const coverImageBlob = base64ToBlob(themeData.coverImage);
const images = themeData.images.map((image) => ({ const images = themeData.images.map((image) => ({
@@ -38,7 +42,7 @@ export const StoreDownloadTheme = async (theme: { themeContent: Theme }) => {
await localforage.setItem(themeData.id, { await localforage.setItem(themeData.id, {
...themeData, ...themeData,
webURL: theme.themeContent.id, webURL: themeData.id,
coverImage: coverImageBlob, coverImage: coverImageBlob,
CustomImages: themeData.images.map((image) => { CustomImages: themeData.images.map((image) => {
return { return {
@@ -47,6 +51,4 @@ export const StoreDownloadTheme = async (theme: { themeContent: Theme }) => {
}; };
}) })
}); });
}; };
export default StoreDownloadTheme;