From e7943fbfd3e665be4ce09ce8d5bad398876e1f6e Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Tue, 21 May 2024 19:42:33 +1000 Subject: [PATCH] separate installtheme logic --- src/seqta/ui/themes/downloadTheme.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/seqta/ui/themes/downloadTheme.ts b/src/seqta/ui/themes/downloadTheme.ts index 65f3df57..6f384d8a 100644 --- a/src/seqta/ui/themes/downloadTheme.ts +++ b/src/seqta/ui/themes/downloadTheme.ts @@ -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 themeData = await themeContent.json() as ThemeContent; + await InstallTheme(themeData); +}; + +export const InstallTheme = async (themeData: ThemeContent) => { const coverImageBlob = base64ToBlob(themeData.coverImage); const images = themeData.images.map((image) => ({ @@ -38,7 +42,7 @@ export const StoreDownloadTheme = async (theme: { themeContent: Theme }) => { await localforage.setItem(themeData.id, { ...themeData, - webURL: theme.themeContent.id, + webURL: themeData.id, coverImage: coverImageBlob, CustomImages: themeData.images.map((image) => { return { @@ -47,6 +51,4 @@ export const StoreDownloadTheme = async (theme: { themeContent: Theme }) => { }; }) }); -}; - -export default StoreDownloadTheme; +}; \ No newline at end of file