diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts
index 8b5e5fb..80826c2 100644
--- a/src/app/app.routes.ts
+++ b/src/app/app.routes.ts
@@ -1,3 +1,3 @@
import {Routes} from '@angular/router';
-export const routes: Routes = [];
+export const routes: Routes = [];
\ No newline at end of file
diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html
index f7e59f1..200fb67 100644
--- a/src/app/pages/login/login.component.html
+++ b/src/app/pages/login/login.component.html
@@ -19,7 +19,7 @@
} @else {
-
+
}
diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts
index dab831d..5a6d77f 100644
--- a/src/app/pages/login/login.component.ts
+++ b/src/app/pages/login/login.component.ts
@@ -2,8 +2,9 @@ import {Component, inject, signal, viewChild} from '@angular/core';
import {IonicModule} from "@ionic/angular";
import {SignInFormComponent} from "../../components/sign-in-form/sign-in-form.component";
import {SignOnFormComponent} from "../../components/sign-on-form/sign-on-form.component";
-import {firstValueFrom} from "rxjs";
import {AuthManageService} from "../../services/auth-manage";
+import {firstValueFrom} from "rxjs";
+import {UsersService} from "../../services/api";
@Component({
selector: 'app-login',
@@ -18,13 +19,16 @@ import {AuthManageService} from "../../services/auth-manage";
export class LoginComponent {
authState = signal(true)
login = viewChild('loginForm');
+ user = viewChild('userForm');
private authManageService = inject(AuthManageService);
+ private usersService = inject(UsersService);
- createAccount() {
+ async createAccount() {
if (this.authState()) {
this.authState.set(false);
} else if (this.authState() == false) {
+ await this.addUser();
this.authState.set(true);
}
}
@@ -34,4 +38,18 @@ export class LoginComponent {
console.log(user);
this.authManageService.connectUser(user.username, user.password);
}
+
+ async addUser() {
+ if (this.user().userForm.invalid) {
+ console.log('Erreur d\'écriture dans le formulaire');
+ return;
+ }
+ try {
+ const users = this.user().userForm.getRawValue();
+ await firstValueFrom(this.usersService.createUserEndpoint(users))
+ console.log('Utilisateur crée : ' + users);
+ } catch (e) {
+ console.log(e);
+ }
+ }
}
diff --git a/src/app/services/api/README.md b/src/app/services/api/README.md
index 44c14b0..f9e031a 100644
--- a/src/app/services/api/README.md
+++ b/src/app/services/api/README.md
@@ -59,9 +59,9 @@ In your Angular project:
```typescript
-import { ApplicationConfig } from '@angular/core';
-import { provideHttpClient } from '@angular/common/http';
-import { provideApi } from '';
+import {ApplicationConfig} from '@angular/core';
+import {provideHttpClient} from '@angular/common/http';
+import {provideApi} from '';
export const appConfig: ApplicationConfig = {
providers: [
@@ -77,15 +77,15 @@ If you're still using `AppModule` and haven't [migrated](https://angular.dev/ref
can still import an Angular module:
```typescript
-import { ApiModule } from '';
+import {ApiModule} from '';
```
If different from the generated base path, during app bootstrap, you can provide the base path to your service.
```typescript
-import { ApplicationConfig } from '@angular/core';
-import { provideHttpClient } from '@angular/common/http';
-import { provideApi } from '';
+import {ApplicationConfig} from '@angular/core';
+import {provideHttpClient} from '@angular/common/http';
+import {provideApi} from '';
export const appConfig: ApplicationConfig = {
providers: [
@@ -98,9 +98,9 @@ export const appConfig: ApplicationConfig = {
```typescript
// with a custom configuration
-import { ApplicationConfig } from '@angular/core';
-import { provideHttpClient } from '@angular/common/http';
-import { provideApi } from '';
+import {ApplicationConfig} from '@angular/core';
+import {provideHttpClient} from '@angular/common/http';
+import {provideApi} from '';
export const appConfig: ApplicationConfig = {
providers: [
@@ -147,10 +147,10 @@ you can create an alias name when importing the modules
in order to avoid naming conflicts:
```typescript
-import { provideApi as provideUserApi } from 'my-user-api-path';
-import { provideApi as provideAdminApi } from 'my-admin-api-path';
-import { HttpClientModule } from '@angular/common/http';
-import { environment } from '../environments/environment';
+import {provideApi as provideUserApi} from 'my-user-api-path';
+import {provideApi as provideAdminApi} from 'my-admin-api-path';
+import {HttpClientModule} from '@angular/common/http';
+import {environment} from '../environments/environment';
export const appConfig: ApplicationConfig = {
providers: [
diff --git a/src/app/services/api/model/error-response.ts b/src/app/services/api/model/error-response.ts
new file mode 100644
index 0000000..8934461
--- /dev/null
+++ b/src/app/services/api/model/error-response.ts
@@ -0,0 +1,29 @@
+/**
+ * BeReadyBackend
+ *
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+/**
+ * the dto used to send an error response to the client
+ */
+export interface ErrorResponse {
+ /**
+ * the http status code sent to the client. default is 400.
+ */
+ statusCode?: number;
+ /**
+ * the message for the error response
+ */
+ message?: string;
+ /**
+ * the collection of errors for the current context
+ */
+ errors?: { [key: string]: Array; };
+}
+