improved textField component and allowed 8 caracter names

This commit is contained in:
arp 2020-10-15 12:05:40 +02:00
parent 49a0125f88
commit 67a9bd2520
10 changed files with 36 additions and 35 deletions

View file

@ -1,5 +1,6 @@
import {LocalUser} from "./LocalUser";
//todo: add localstorage fallback
class LocalUserStore {
saveUser(localUser: LocalUser) {
@ -10,6 +11,14 @@ class LocalUserStore {
const data = localStorage.getItem('localUser');
return data ? JSON.parse(data) : null;
}
setName(name:string): void {
window.localStorage.setItem('playerName', name);
}
getName(): string {
return window.localStorage.getItem('playerName') ?? '';
}
}