aboutsummaryrefslogtreecommitdiff
path: root/src/stores/userIdentity.ts
blob: 4b90358d5a719ee6e1c40f555c611c6fc4f03428 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
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;