From c4e8e7483a9feb255573434381c7afec472db309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Mon, 4 Nov 2024 11:24:14 +0100 Subject: [PATCH] RLH-18 | Implement Account rename APIs --- .gitignore | 3 +++ src/app/services/account.service.spec.ts | 16 ++++++++++++++ src/app/services/account.service.ts | 27 ++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 src/app/services/account.service.spec.ts create mode 100644 src/app/services/account.service.ts 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); + } +}