Fix dates not being initialized when retrieved from storage.
This commit is contained in:
parent
5798eefb72
commit
0f115971c6
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue