aboutsummaryrefslogtreecommitdiff
path: root/src/stores/userIdentity.ts
blob: e50182686c37f6aa3445c01a034941f533965dbe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import { browser } from '$app/environment';
import { writable } from 'svelte/store';

const userIdentity = writable<string>(browser ? localStorage.getItem('userIdentity') ?? '' : '');

userIdentity.subscribe((value) => {
	if (browser) {
		localStorage.setItem('userIdentity', value);
	}
});

export default userIdentity;