aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/auth.service.ts
diff options
context:
space:
mode:
authorDanijel Andjelkovic <adanijel99@gmail.com>2022-03-07 18:29:12 +0100
committerDanijel Andjelkovic <adanijel99@gmail.com>2022-03-07 18:29:12 +0100
commitc59ff03b96d7b638623c254dfe8477055aeb2a35 (patch)
tree933ffdbf0e0d4300424d73c11bbcc8156851a71c /frontend/src/app/auth.service.ts
parent9b925712cbdedacdf8af947e929ca3975b56e3fa (diff)
parentcd2188997ff4cbcce83e3cada3fc220375ebc78e (diff)
Merge branch 'frontendLoginRegister' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into frontend
# Conflicts: # frontend/package-lock.json # frontend/package.json
Diffstat (limited to 'frontend/src/app/auth.service.ts')
-rw-r--r--frontend/src/app/auth.service.ts31
1 files changed, 0 insertions, 31 deletions
diff --git a/frontend/src/app/auth.service.ts b/frontend/src/app/auth.service.ts
deleted file mode 100644
index 29dca31d..00000000
--- a/frontend/src/app/auth.service.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { Injectable } from '@angular/core';
-import { HttpClient, HttpHeaders } from '@angular/common/http';
-import { JwtHelperService } from '@auth0/angular-jwt';
-import { CookieService } from 'ngx-cookie-service';
-import { API_SETTINGS } from 'src/config';
-
-const jwtHelper = new JwtHelperService();
-
-@Injectable({
- providedIn: 'root'
-})
-export class AuthService {
-
- constructor(private http: HttpClient, private cookie: CookieService) { }
-
- login(username: string, password: string) {
- return this.http.post(`${API_SETTINGS.apiURL}/login`, { username, password });
- }
-
- register(username: string, password: string) {
- return this.http.post(`${API_SETTINGS.apiURL}/register`, { username, password });
- }
-
- isAuthenticated(): boolean {
- if (this.cookie.check('token')) {
- var token = this.cookie.get('token');
- return !jwtHelper.isTokenExpired(token);
- }
- return false;
- }
-}