Fix dates not being initialized when retrieved from storage.

This commit is contained in:
Bauke 2020-11-11 18:47:21 +01:00
parent 5798eefb72
commit 0f115971c6
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 9 additions and 1 deletions

View File

@ -23,9 +23,17 @@ const defaultSettings: Settings = {
*/ */
export async function getSettings(): Promise<Settings> { export async function getSettings(): Promise<Settings> {
const syncSettings: any = await browser.storage.sync.get(defaultSettings); const syncSettings: any = await browser.storage.sync.get(defaultSettings);
const queue: QItem[] = syncSettings.queue;
// Initialize all the non-JSON values, as they are stringified when saved.
for (const item of queue) {
item.added = new Date(item.added);
}
const settings: Settings = { const settings: Settings = {
latestVersion: syncSettings.latestVersion, latestVersion: syncSettings.latestVersion,
queue: syncSettings.queue queue
}; };
return settings; return settings;