fixed null setting if remove active account

This commit is contained in:
Quan HL
2024-09-17 06:39:34 +07:00
parent e6b8903f36
commit 8af172d527

View File

@@ -126,14 +126,16 @@ export const getActiveSettings = (): IAppSettings => {
JSON.parse(str);
const activeSettings = parsed.find((el) => el.active);
const decoded = {
active: activeSettings?.active,
decoded: JSON.parse(
Buffer.from(activeSettings?.encoded!, "base64").toString("utf-8")
),
id: activeSettings?.id,
};
return decoded as IAppSettings;
if (activeSettings) {
const decoded = {
active: activeSettings?.active,
decoded: JSON.parse(
Buffer.from(activeSettings?.encoded!, "base64").toString("utf-8")
),
id: activeSettings?.id,
};
return decoded as IAppSettings;
}
}
return {} as IAppSettings;
};