user.js 403 B

12345678910111213141516171819
  1. class UserService {
  2. get username() {
  3. if (!localStorage.username) {
  4. localStorage.setItem('username', 'Utilisateur')
  5. }
  6. return localStorage.username;
  7. }
  8. set username(newName) {
  9. if (newName.trim() === '') {
  10. newName = 'Utilisateur';
  11. }
  12. localStorage.setItem('username', newName);
  13. }
  14. }
  15. module.exports = new UserService();