diff --git a/.gitignore b/.gitignore index cc7b141..4d2d0db 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ testem.log # System files .DS_Store Thumbs.db + +.nx/cache +.nx/workspace-data diff --git a/src/app/services/account.service.spec.ts b/src/app/services/account.service.spec.ts new file mode 100644 index 0000000..2ffad6f --- /dev/null +++ b/src/app/services/account.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { AccountService } from './account.service'; + +describe('AccountService', () => { + let service: AccountService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(AccountService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/account.service.ts b/src/app/services/account.service.ts new file mode 100644 index 0000000..bf8e84a --- /dev/null +++ b/src/app/services/account.service.ts @@ -0,0 +1,27 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from "@angular/common/http"; +import {UserData} from "../interface/user"; +import {Observable} from "rxjs"; + +@Injectable({ + providedIn: 'root' +}) +export class AccountService { + + private apiUrl = 'http://localhost:8080/api/'; + + constructor( + private http: HttpClient + ) {} + + // v1 ACCOUNT + changeUsername(uuid: string, username: string): Observable { + + const body = { + uuid: uuid, + username: username + } + + return this.http.post(this.apiUrl + 'v1/account/edit', body); + } +}