aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/services
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-ui/src/app/services')
-rw-r--r--ufund-ui/src/app/services/cupboard.service.spec.ts16
-rw-r--r--ufund-ui/src/app/services/users.service.spec.ts16
-rw-r--r--ufund-ui/src/app/services/users.service.ts6
3 files changed, 6 insertions, 32 deletions
diff --git a/ufund-ui/src/app/services/cupboard.service.spec.ts b/ufund-ui/src/app/services/cupboard.service.spec.ts
deleted file mode 100644
index 56da56d..0000000
--- a/ufund-ui/src/app/services/cupboard.service.spec.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { TestBed } from '@angular/core/testing';
-
-import { CupboardService } from './cupboard.service';
-
-describe('CupboardService', () => {
- let service: CupboardService;
-
- beforeEach(() => {
- TestBed.configureTestingModule({});
- service = TestBed.inject(CupboardService);
- });
-
- it('should be created', () => {
- expect(service).toBeTruthy();
- });
-});
diff --git a/ufund-ui/src/app/services/users.service.spec.ts b/ufund-ui/src/app/services/users.service.spec.ts
deleted file mode 100644
index f81244a..0000000
--- a/ufund-ui/src/app/services/users.service.spec.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { TestBed } from '@angular/core/testing';
-
-import { UsersService } from './users.service';
-
-describe('UsersService', () => {
- let service: UsersService;
-
- beforeEach(() => {
- TestBed.configureTestingModule({});
- service = TestBed.inject(UsersService);
- });
-
- it('should be created', () => {
- expect(service).toBeTruthy();
- });
-});
diff --git a/ufund-ui/src/app/services/users.service.ts b/ufund-ui/src/app/services/users.service.ts
index 1b6dfb6..571c004 100644
--- a/ufund-ui/src/app/services/users.service.ts
+++ b/ufund-ui/src/app/services/users.service.ts
@@ -8,6 +8,8 @@ import {User} from '../models/User';
})
export class UsersService {
+ private currentUserID? : number
+
private url = "http://localhost:8080/users"
private httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
@@ -32,4 +34,8 @@ export class UsersService {
deleteUser(id: number): Observable<boolean> {
return this.http.delete<boolean>(`${this.url}/${id}`, this.httpOptions)
}
+
+ getCurrentUser(): Observable<User> | undefined {
+ return this.currentUserID ? this.getUser(this.currentUserID) : undefined
+ }
}