Website Summary Files Commits Branches @commit @diff @stats
path: root / scripts / services / userService.js
diff options
context:
space:
mode:
Commitb25309b92d3e6d495713c53e6b259afd0472c8b7 (patch)
Author
 ivaylo.zhelev <ivaylo.zhelev@solarwinds.com>
2021-01-24 14:58:18 +0200
Committer
 ivaylo.zhelev <ivaylo.zhelev@solarwinds.com>
2021-01-24 14:58:18 +0200
Files972d3c849210c4539617dd4b33a998bc59fdeb03 /scripts/services/userService.js
pusg-front-end-b25309b92d3e6d495713c53e6b259afd0472c8b7.tar
pusg-front-end-b25309b92d3e6d495713c53e6b259afd0472c8b7.tar.gz
pusg-front-end-b25309b92d3e6d495713c53e6b259afd0472c8b7.zip
Parent98fe3a58175b19b9a31db0550caba463de802607 (diff)
Restructured Folder
1 files changed, 24 insertions, 0 deletions
-rw-r--r--scripts/services/userService.js24
diff --git a/scripts/services/userService.js b/scripts/services/userService.js
new file mode 100644
index 0000000..103e156
--- /dev/null
+++ b/scripts/services/userService.js
@@ -0,0 +1,24 @@
+var app = app || {};
+
+class UserService {
+ constructor() {
+ this.user = null;
+ }
+
+ login() {
+ if(!this.user) {
+ const username = prompt('Please, enter a Username:');
+
+ if (username) {
+ app.socketService.send('Login', username);
+ this.user = username;
+ }
+ }
+ }
+
+ isLoggedIn() {
+ return this.user;
+ }
+}
+
+app.userService = new UserService();