store currentDeviceId in localstorage

dev
Anton Franzluebbers 2023-11-02 16:48:39 -04:00
parent d8656a78d4
commit ab3edafc70
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@velaboratory/velconnect-svelte", "name": "@velaboratory/velconnect-svelte",
"version": "1.0.4", "version": "1.0.5",
"description": "Use VEL-Connect with a Svelte dashboard", "description": "Use VEL-Connect with a Svelte dashboard",
"main": "src/index.js", "main": "src/index.js",
"files": [ "files": [
@ -20,4 +20,4 @@
"devDependencies": { "devDependencies": {
"typescript": "^5.1.6" "typescript": "^5.1.6"
} }
} }

View File

@ -21,7 +21,9 @@ pb.authStore.onChange((auth) => {
}); });
export const pairedDevices = writable<string[]>([]); export const pairedDevices = writable<string[]>([]);
export const currentDeviceId = writable(""); const storedCurrentDeviceId = localStorage.getItem('currentDeviceId');
export const currentDeviceId = writable(storedCurrentDeviceId || "");
currentDeviceId.subscribe((value) => localStorage.setItem('currentDeviceId', value));
export interface Device extends Record { export interface Device extends Record {
os_info: string; os_info: string;
@ -331,4 +333,4 @@ function log(msg: string) {
if (debugLog) { if (debugLog) {
console.log(msg); console.log(msg);
} }
} }