mirror of
https://github.com/lainbo/component-party.git
synced 2026-04-05 13:09:03 +08:00
16 lines
339 B
JavaScript
16 lines
339 B
JavaScript
import { writable } from "svelte/store";
|
|
|
|
export default function createUserStore(initialData) {
|
|
const userStore = writable(initialData);
|
|
|
|
return {
|
|
subscribe: userStore.subscribe,
|
|
updateUsername(newUsername) {
|
|
userStore.update((userData) => ({
|
|
...userData,
|
|
username: newUsername,
|
|
}));
|
|
},
|
|
};
|
|
}
|