diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index bbc5f51..4587264 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -15,7 +15,6 @@ import { PageNotFoundComponent } from './pages/page-not-found/page-not-found.com import { PageRepertoireComponent } from './pages/page-repertoire/page-repertoire.component'; import { PageResetPasswordComponent } from './pages/page-reset-password/page-reset-password.component'; import { PageSignupComponent } from './pages/page-signup/page-signup.component'; -import { PageTestFormComponent } from './pages/page-test-form/page-test-form.component'; import { PageToDoListComponent } from './pages/page-to-do-list/page-to-do-list.component'; import { PageUpdateMemberComponent } from './pages/page-update-member/page-update-member.component'; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 7dcf04b..3f9fcc5 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -36,14 +36,10 @@ import { HttpClientModule } from '@angular/common/http'; import { PageAjoutContactComponent } from './pages/page-ajout-contact/page-ajout-contact.component'; import { PageModifierContactComponent } from './pages/page-modifier-contact/page-modifier-contact.component'; import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component'; -<<<<<<< HEAD -import { PageTestFormComponent } from './pages/page-test-form/page-test-form.component'; -======= import { AutofocusFixModule } from 'ngx-autofocus-fix'; ->>>>>>> 5c7e4662b2e3c8af6778c79d1b56aa66a0fdf0a1 @NgModule({ declarations: [ @@ -79,11 +75,6 @@ import { AutofocusFixModule } from 'ngx-autofocus-fix'; PageAjoutContactComponent, PageModifierContactComponent, PageCreationTeamComponent, -<<<<<<< HEAD - PageTestFormComponent, -======= - ->>>>>>> 5c7e4662b2e3c8af6778c79d1b56aa66a0fdf0a1 ], imports: [ BrowserModule, diff --git a/src/app/pages/page-creation-team/page-creation-team.component.ts b/src/app/pages/page-creation-team/page-creation-team.component.ts index 9326242..c7a9ec7 100644 --- a/src/app/pages/page-creation-team/page-creation-team.component.ts +++ b/src/app/pages/page-creation-team/page-creation-team.component.ts @@ -7,7 +7,7 @@ import { } from '@angular/forms'; import { Router } from '@angular/router'; import { Team } from 'src/app/models/team'; -import { AuthService } from '../../services/auth.service'; +import { TeamService } from 'src/app/services/team.service'; @Component({ selector: 'app-page-creation-team', @@ -17,7 +17,7 @@ import { AuthService } from '../../services/auth.service'; export class PageCreationTeamComponent implements OnInit { public teamForm: FormGroup; constructor( - private authService: AuthService, + private teamService: TeamService, private router: Router, private fb: FormBuilder ) { @@ -43,7 +43,7 @@ export class PageCreationTeamComponent implements OnInit { if (team.nom !== '' ) { - this.authService.creationTeam(team).subscribe((resp) => { + this.teamService.addTeam(team).subscribe((resp) => { this.router.navigate(['compte']); }); } else { diff --git a/src/app/pages/page-test-form/page-test-form.component.html b/src/app/pages/page-test-form/page-test-form.component.html deleted file mode 100644 index d9f78fc..0000000 --- a/src/app/pages/page-test-form/page-test-form.component.html +++ /dev/null @@ -1,80 +0,0 @@ -

page-test-form works!

- -
-
-
-

Incrivez-vous !

-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- - - -
-
-
diff --git a/src/app/pages/page-test-form/page-test-form.component.scss b/src/app/pages/page-test-form/page-test-form.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/pages/page-test-form/page-test-form.component.spec.ts b/src/app/pages/page-test-form/page-test-form.component.spec.ts deleted file mode 100644 index f1a9abd..0000000 --- a/src/app/pages/page-test-form/page-test-form.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { PageTestFormComponent } from './page-test-form.component'; - -describe('PageTestFormComponent', () => { - let component: PageTestFormComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ PageTestFormComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(PageTestFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/pages/page-test-form/page-test-form.component.ts b/src/app/pages/page-test-form/page-test-form.component.ts deleted file mode 100644 index 056d5ac..0000000 --- a/src/app/pages/page-test-form/page-test-form.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-page-test-form', - templateUrl: './page-test-form.component.html', - styleUrls: ['./page-test-form.component.scss'] -}) -export class PageTestFormComponent implements OnInit { - - constructor() { } - - ngOnInit(): void { - } - -} diff --git a/src/app/services/team.service.spec.ts b/src/app/services/team.service.spec.ts new file mode 100644 index 0000000..d9ca39e --- /dev/null +++ b/src/app/services/team.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { TeamService } from '../services/team.service'; + +describe('TeamService', () => { + let service: TeamService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(TeamService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/team.service.ts b/src/app/services/team.service.ts new file mode 100644 index 0000000..1aed726 --- /dev/null +++ b/src/app/services/team.service.ts @@ -0,0 +1,41 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { environment } from 'src/environments/environment'; +import { Team } from '../models/team'; + +@Injectable({ + providedIn: 'root' +}) +export class TeamService { + apiUrl: string; + tokenKey: string; + + + constructor(private http: HttpClient) { + this.apiUrl = environment.apiUrl; + this.tokenKey = environment.tokenKey; + } + getTeams(): Observable { + return this.http.get(`${this.apiUrl}/teams/all`); + } + + getTeamById(id: any): Observable { + return this.http.get(`${this.apiUrl}/teams/1` + id); + } + + addTeam(team: Team): Observable { + console.log(team); + + return this.http.post(`${this.apiUrl}/teams/add`, team); + } + + deleteTeam(team: Team): Observable { + return this.http.delete(`${this.apiUrl}/teams/delete/1`); + } + + updateTeam(team: Team): Observable { + return this.http.put(`${this.apiUrl}/teams/update/1`, team); + } + +}