add usedid to model

This commit is contained in:
marlon-erler
2026-09-27 01:46:55 +02:00
parent 9622c196cd
commit 42421e31ee
2 changed files with 14 additions and 2 deletions
+13 -2
View File
@@ -1,5 +1,4 @@
// cleanup: Phase A
import {UUID} from "../../react";
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
export default class SettingsModel {
@@ -7,6 +6,7 @@ export default class SettingsModel {
// data
username: string = "";
userid: string = "";
firstDayOfWeek: string = "";
language: string = "";
theme: string = "";
@@ -23,6 +23,11 @@ export default class SettingsModel {
this.storageModel.write(path, value);
};
readonly setId = (newValue: string): void => {
this.userid = newValue;
this.storeSetting("userid", newValue);
};
readonly setName = (newValue: string): void => {
this.username = newValue;
this.storeSetting("username", newValue);
@@ -53,6 +58,11 @@ export default class SettingsModel {
);
return this.storageModel.read(path);
};
readonly loadID = (): void => {
const content: string | null = this.readSetting("userid");
this.userid = content ?? UUID();
};
readonly loadUsername = (): void => {
const content: string | null = this.readSetting("username");
@@ -78,6 +88,7 @@ export default class SettingsModel {
constructor(storageModel: StorageModel) {
this.storageModel = storageModel;
this.loadID();
this.loadUsername();
this.loadFirstDayofWeek();
this.loadLanguage();