Add func to read wishlist from disk
This commit is contained in:
parent
48314d97b0
commit
45fb46efa5
|
@ -7,3 +7,14 @@ const saveToDisk = (path: string, content: any) => fs.writeFileSync(path, JSON.s
|
|||
|
||||
export const saveJfItemsToDisk = (content: {}) => saveToDisk(JELLYFIN_CONTENT_PATH, content);
|
||||
export const saveWishlistToDisk = (content: {}) => saveToDisk(WISHLIST_PATH, content);
|
||||
|
||||
export const readWishlistFromDisk = () => {
|
||||
let wishlistContent: string[] = [];
|
||||
if (fs.existsSync(WISHLIST_PATH)) {
|
||||
const fileContent = JSON.parse(fs.readFileSync(WISHLIST_PATH, "utf8"));
|
||||
wishlistContent = fileContent.wishlistContent;
|
||||
} else {
|
||||
saveWishlistToDisk({ wishlistContent });
|
||||
}
|
||||
return wishlistContent;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue