summaryrefslogtreecommitdiff
path: root/ui/lib/state/remote/logins.svelte.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/lib/state/remote/logins.svelte.js')
-rw-r--r--ui/lib/state/remote/logins.svelte.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/ui/lib/state/remote/logins.svelte.js b/ui/lib/state/remote/logins.svelte.js
new file mode 100644
index 0000000..d19068d
--- /dev/null
+++ b/ui/lib/state/remote/logins.svelte.js
@@ -0,0 +1,18 @@
+import { SvelteMap } from 'svelte/reactivity';
+
+export class Logins {
+ all = $state();
+
+ static boot(logins) {
+ const all = new SvelteMap(logins.map((login) => [login.id, login]));
+ return new Logins({ all });
+ }
+
+ constructor({ all }) {
+ this.all = all;
+ }
+
+ add({ id, name }) {
+ this.all.set(id, { id, name });
+ }
+}