Rachelle 6 gadus atpakaļ
vecāks
revīzija
997b1dc1b9

+ 0
- 3
MyPassionProject/src/main/java/com/example/demo/Repository/GameRepo.java Parādīt failu

@@ -5,10 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
5 5
 import org.springframework.data.jpa.repository.Query;
6 6
 import org.springframework.data.repository.query.Param;
7 7
 import org.springframework.data.rest.core.annotation.RepositoryRestResource;
8
-import org.springframework.http.ResponseEntity;
9
-
10 8
 import java.util.Collection;
11
-import java.util.Set;
12 9
 
13 10
 @RepositoryRestResource
14 11
 public interface GameRepo extends JpaRepository<Game,Long> {

+ 2
- 0
MyPassionProjectClient/src/app/app.module.ts Parādīt failu

@@ -7,6 +7,7 @@ import { StatusBar } from '@ionic-native/status-bar';
7 7
 import { MyApp } from './app.component';
8 8
 import {MenuPageModule} from "../pages/menu/menu.module";
9 9
 import { HttpClientModule } from '../../node_modules/@angular/common/http';
10
+import { UsersService } from '../providers/users-service';
10 11
 
11 12
 
12 13
 @NgModule({
@@ -26,6 +27,7 @@ import { HttpClientModule } from '../../node_modules/@angular/common/http';
26 27
   providers: [
27 28
     StatusBar,
28 29
     SplashScreen,
30
+    UsersService,
29 31
     {provide: ErrorHandler, useClass: IonicErrorHandler}
30 32
   ]
31 33
 })

+ 3
- 3
MyPassionProjectClient/src/pages/signup/signup.html Parādīt failu

@@ -8,18 +8,18 @@
8 8
 
9 9
 
10 10
 <ion-content>
11
-  <form (submit)="doSignup()">
11
+  <form (submit)="createAccount()">
12 12
     <ion-list>
13 13
 
14 14
       <ion-item>
15 15
         <ion-label floating>Profilename</ion-label>
16
-        <ion-input type="text" [(ngModel)]="account.profilename" name="profilename"></ion-input>
16
+        <ion-input type="text" [(ngModel)]="account.profileName" name="profilename"></ion-input>
17 17
       </ion-item>
18 18
 
19 19
       <ion-item>
20 20
         <!--<ion-label fixed>{{ 'USERNAME' | translate }}</ion-label>-->
21 21
         <ion-label floating>Username</ion-label>
22
-        <ion-input type="text" [(ngModel)]="account.username" name="username"></ion-input>
22
+        <ion-input type="text" [(ngModel)]="account.userName" name="username"></ion-input>
23 23
       </ion-item>
24 24
 
25 25
       <ion-item>

+ 9
- 6
MyPassionProjectClient/src/pages/signup/signup.ts Parādīt failu

@@ -1,6 +1,7 @@
1 1
 import { Component } from '@angular/core';
2 2
 import { IonicPage, NavController, NavParams } from 'ionic-angular';
3 3
 import {MenuPage} from "../menu/menu";
4
+import { UsersService } from '../../providers/users-service';
4 5
 
5 6
 /**
6 7
  * Generated class for the SignupPage page.
@@ -15,17 +16,19 @@ import {MenuPage} from "../menu/menu";
15 16
   templateUrl: 'signup.html',
16 17
 })
17 18
 export class SignupPage {
18
-  account: { profilename: string, username: string, password: string } = {
19
-    profilename:'',
20
-    username:'',
19
+  account = {
20
+    profileName:'',
21
+    userName:'',
21 22
     password:''
22 23
   };
23 24
 
24
-  constructor(public navCtrl: NavController, public navParams: NavParams) {
25
+  constructor(public navCtrl: NavController, public navParams: NavParams, private usersService: UsersService) {
25 26
   }
26 27
 
27
-  doSignup() {
28
-    this.navCtrl.setRoot(MenuPage);
28
+  createAccount() {
29
+    this.usersService.addUser(this.account).subscribe(response  => {
30
+      this.navCtrl.setRoot(MenuPage);
31
+    })
29 32
   }
30 33
 
31 34
 }

+ 5
- 0
MyPassionProjectClient/src/providers/users-service.ts Parādīt failu

@@ -13,4 +13,9 @@ export class UsersService{
13 13
   getUserById() {
14 14
       return this.http.get(this.USERS_API+"/1")
15 15
   }
16
+
17
+  addUser(account): Observable<any>{
18
+    console.log(account);
19
+    return this.http.post(this.USERS_API,account);
20
+  }
16 21
 }