fix: clear settings on logout

This commit is contained in:
thecodrr
2020-12-10 14:16:05 +05:00
parent ae4a1f9c61
commit fa9c1ac2d2

View File

@@ -31,6 +31,15 @@ class Settings {
var settings = await this._db.context.read("settings"); var settings = await this._db.context.read("settings");
if (!settings) await this._db.context.write("settings", this._settings); if (!settings) await this._db.context.write("settings", this._settings);
else this._settings = settings; else this._settings = settings;
EV.subscribe("user:loggedOut", () => {
this._settings = {
type: "settings",
id: id(),
pins: [],
dateEdited: 0,
dateCreated: Date.now(),
};
});
} }
async pin(type, data) { async pin(type, data) {