This commit is contained in:
2020-12-18 19:47:58 +01:00
parent 4bb3bae4e6
commit 32357ece0a
18 changed files with 5862 additions and 7900 deletions

42
src/store.js Normal file
View File

@@ -0,0 +1,42 @@
import { writable } from 'svelte/store';
const store = () => {
const state = {
isLoggedIn: false
};
const { subscribe, set, update } = writable(state);
const methods = {
init() {
console.log('*: playerStore -> init()');
update((state) => {
state.isLoggedIn = false;
return state;
});
},
login() {
update((state) => {
state.isLoggedIn = true;
console.log('login performed');
return state;
});
},
logout() {
update((state) => {
state.isLoggedIn = false;
return state;
});
}
};
return {
subscribe,
set,
update,
...methods
};
};
export default store();