RLH-18 | Implement Account rename APIs

This commit is contained in:
Bea 2024-11-04 11:24:14 +01:00
parent 5e5b81743a
commit c4e8e7483a
3 changed files with 46 additions and 0 deletions

3
.gitignore vendored
View File

@ -40,3 +40,6 @@ testem.log
# System files
.DS_Store
Thumbs.db
.nx/cache
.nx/workspace-data

View File

@ -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();
});
});

View File

@ -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<string> {
const body = {
uuid: uuid,
username: username
}
return this.http.post<string>(this.apiUrl + 'v1/account/edit', body);
}
}