diff --git a/src/app/admin/utils/navbar-admin/navbar-admin.component.ts b/src/app/admin/utils/navbar-admin/navbar-admin.component.ts index e23ae05..dd4f436 100644 --- a/src/app/admin/utils/navbar-admin/navbar-admin.component.ts +++ b/src/app/admin/utils/navbar-admin/navbar-admin.component.ts @@ -28,7 +28,7 @@ export class NavbarAdminComponent onDeconnexion(): void { this.messageService - .delete('user/logout', {}) + .delete('user/logout') .subscribe(retour => this.onDeconnexionCallback(retour), err => this.onDeconnexionCallback(err)); } diff --git a/src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.ts b/src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.ts index a0e5181..9bd8e1e 100644 --- a/src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.ts +++ b/src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.ts @@ -29,7 +29,7 @@ export class NavbarAdvertiserComponent onDeconnexion(): void { this.messageService - .delete('user/logout', {}) + .delete('user/logout') .subscribe(retour => this.onDeconnexionCallback(retour), err => this.onDeconnexionCallback(err)); } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index dc121e6..133f928 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -26,7 +26,7 @@ import {MatGridListModule} from "@angular/material/grid-list"; import { PageMyPlaylistsComponent } from './user/myPlaylists/page-my-playlists/page-my-playlists.component'; import { PlaylistListComponent } from './user/myPlaylists/playlist-list/playlist-list.component'; import {VideoListComponent} from "./user/myPlaylists/video-list/video-list.component"; -import { PopupCreatePlaylistComponent } from './user/myPlaylists/popup-create-playlist/popup-create-playlist.component'; +import { PopupCreateOrUpdatePlaylistComponent } from './user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component'; import { PageHistoryUserComponent } from './user/history/page-history-user/page-history-user.component'; import {MatTableModule} from '@angular/material/table'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; @@ -87,7 +87,7 @@ import { PopupForgottenPasswordComponent } from './beforeConnexion/login/popup-f VideoListComponent, PlaylistListComponent, VideoListComponent, - PopupCreatePlaylistComponent, + PopupCreateOrUpdatePlaylistComponent, PageHistoryUserComponent, PageAdListAdvertiserComponent, PopupDeleteAdAdvertiserComponent, diff --git a/src/app/beforeConnexion/login/page-login/page-login.component.ts b/src/app/beforeConnexion/login/page-login/page-login.component.ts index d53bf46..ad2f03b 100644 --- a/src/app/beforeConnexion/login/page-login/page-login.component.ts +++ b/src/app/beforeConnexion/login/page-login/page-login.component.ts @@ -58,6 +58,7 @@ export class PageLoginComponent implements OnInit this.hasError = true; } else { + this.profilService.id = retour.data.id; this.profilService.profileImageUrl = retour.data.profileImageUrl; if(retour.data.role.name === "user") this.router.navigateByUrl( '/user/search'); else if(retour.data.role.name === "advertiser") this.router.navigateByUrl( '/advertiser/adList'); diff --git a/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.ts b/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.ts index 131c2f9..6f8301b 100644 --- a/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.ts +++ b/src/app/beforeConnexion/register/input-interests-register/input-interests-register.component.ts @@ -37,7 +37,7 @@ export class InputInterestsRegisterComponent implements OnInit map((fruit: string | null) => fruit ? this._filter(fruit) : this.allInterests.slice())); this.messageService - .get("misc/getInterests", {}) + .get("misc/getInterests") .subscribe( retour => { if(retour.status !== "success") { diff --git a/src/app/beforeConnexion/register/page-register/page-register.component.ts b/src/app/beforeConnexion/register/page-register/page-register.component.ts index f24a4f7..8632fe8 100644 --- a/src/app/beforeConnexion/register/page-register/page-register.component.ts +++ b/src/app/beforeConnexion/register/page-register/page-register.component.ts @@ -67,9 +67,8 @@ export class PageRegisterComponent // Gestion de la réponse du backend onEnregistrerCallback(retour): void { - console.log(retour); if(retour.status !== "success") { - + console.log(retour); } else { diff --git a/src/app/user/myPlaylists/playlist-list/playlist-list.component.html b/src/app/user/myPlaylists/playlist-list/playlist-list.component.html index a1c5285..4ab952a 100644 --- a/src/app/user/myPlaylists/playlist-list/playlist-list.component.html +++ b/src/app/user/myPlaylists/playlist-list/playlist-list.component.html @@ -16,7 +16,11 @@
-
+
+ +
{{playlist.name}}
{{playlist.videoIds.length}} vidéo diff --git a/src/app/user/myPlaylists/playlist-list/playlist-list.component.ts b/src/app/user/myPlaylists/playlist-list/playlist-list.component.ts index 1a95744..84a78f4 100644 --- a/src/app/user/myPlaylists/playlist-list/playlist-list.component.ts +++ b/src/app/user/myPlaylists/playlist-list/playlist-list.component.ts @@ -3,9 +3,10 @@ import {ThemeService} from "../../../utils/services/theme/theme.service"; import {PlaylistDB} from "../../../utils/interfaces/playlist"; import {MatDialog} from "@angular/material/dialog"; import {MatSnackBar} from "@angular/material/snack-bar"; -import {PopupCreatePlaylistComponent} from "../popup-create-playlist/popup-create-playlist.component"; +import {PopupCreateOrUpdatePlaylistComponent} from "../popup-create-or-update-playlist/popup-create-or-update-playlist.component"; import {FictitiousVideosService} from "../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service"; import {PopupDeletePlaylistComponent} from "../popup-delete-playlist/popup-delete-playlist.component"; +import {MessageService} from "../../../utils/services/message/message.service"; @@ -26,13 +27,30 @@ export class PlaylistListComponent implements OnInit constructor( public themeService: ThemeService, public dialog: MatDialog, public snackBar: MatSnackBar, - private fictitiousVideosService: FictitiousVideosService ) { } + private fictitiousVideosService: FictitiousVideosService, + private messageService: MessageService ) { } ngOnInit(): void { - this.allPlaylists = this.fictitiousVideosService.getNoRandomTabPlaylistDB(10); - this.tabPlaylist = [].concat(this.allPlaylists); + this.messageService + .get("playlist/findAll") + .subscribe( retour => this.ngOnInitCallback(retour), err => this.ngOnInitCallback(err) ); + } + + + ngOnInitCallback(retour: any): void + { + if(retour.status !== "success") { + console.log(retour); + } else { + const aux = retour.data.filter( x => x.isActive === true); + this.allPlaylists = aux.map(x => { + x["_id"] = x.id ; + return x; + }); + this.tabPlaylist = [].concat(this.allPlaylists); + } } @@ -50,9 +68,14 @@ export class PlaylistListComponent implements OnInit // click sur créer playlist onCreatePlaylist(): void { - const config = { data: this.tabPlaylist }; + const config = { + data: { + action: "create", + tabPlaylist: this.tabPlaylist, + } + }; this.dialog - .open(PopupCreatePlaylistComponent, config ) + .open(PopupCreateOrUpdatePlaylistComponent, config ) .afterClosed() .subscribe(playlist => { @@ -61,6 +84,7 @@ export class PlaylistListComponent implements OnInit this.snackBar.open("Opération annulée", "", config); } else { + playlist["_id"] = playlist.id; this.allPlaylists.push(playlist); this.tabPlaylist.push(playlist); this.snackBar.open(`La playlist '${playlist.name}' a bien été créée ✔`, "", config); @@ -69,6 +93,41 @@ export class PlaylistListComponent implements OnInit } + // click sur update playlist + onUpdatePlaylist(playlistToUpdate: PlaylistDB): void + { + console.log(playlistToUpdate); + + const config = { + data: { + action: "update", + tabPlaylist: this.tabPlaylist, + playlistName: playlistToUpdate.name, + playlistId: playlistToUpdate._id + } + }; + this.dialog + .open(PopupCreateOrUpdatePlaylistComponent, config) + .afterClosed() + .subscribe(newName => { + + console.log("nn:" + newName); + + const config = { duration: 1500, panelClass: "custom-class" }; + if((newName === null) || (newName === undefined)) { + this.snackBar.open("Opération annulée", "", config); + } + else { + let index = this.allPlaylists.findIndex( elt => (elt._id === playlistToUpdate._id)); + this.allPlaylists[index].name = newName; + index = this.tabPlaylist.findIndex( elt => (elt._id === playlistToUpdate._id)); + this.tabPlaylist[index].name = newName; + this.snackBar.open(`La playlist '${playlistToUpdate.name}' a bien été mise à jour ✔`, "", config); + } + }); + } + + // click sur supprimer playlist onDeletePlaylist(playlist: PlaylistDB): void { diff --git a/src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.html b/src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.html similarity index 74% rename from src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.html rename to src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.html index 49ebbf3..c366837 100644 --- a/src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.html +++ b/src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.html @@ -10,7 +10,10 @@
- +
diff --git a/src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.scss b/src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.scss similarity index 100% rename from src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.scss rename to src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.scss diff --git a/src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.spec.ts b/src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.spec.ts similarity index 52% rename from src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.spec.ts rename to src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.spec.ts index a4853cb..640bdbc 100644 --- a/src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.spec.ts +++ b/src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.spec.ts @@ -1,20 +1,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { PopupCreatePlaylistComponent } from './popup-create-playlist.component'; +import { PopupCreateOrUpdatePlaylistComponent } from './popup-create-or-update-playlist.component'; describe('PopupCreatePlaylistComponent', () => { - let component: PopupCreatePlaylistComponent; - let fixture: ComponentFixture; + let component: PopupCreateOrUpdatePlaylistComponent; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ PopupCreatePlaylistComponent ] + declarations: [ PopupCreateOrUpdatePlaylistComponent ] }) .compileComponents(); }); beforeEach(() => { - fixture = TestBed.createComponent(PopupCreatePlaylistComponent); + fixture = TestBed.createComponent(PopupCreateOrUpdatePlaylistComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.ts b/src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.ts new file mode 100644 index 0000000..a6ce4b6 --- /dev/null +++ b/src/app/user/myPlaylists/popup-create-or-update-playlist/popup-create-or-update-playlist.component.ts @@ -0,0 +1,92 @@ +import {Component, Inject, OnInit} from '@angular/core'; +import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; +import {MessageService} from "../../../utils/services/message/message.service"; +import {PlaylistDB} from "../../../utils/interfaces/playlist"; + + + +@Component({ + selector: 'app-popup-create-or-update-playlist', + templateUrl: './popup-create-or-update-playlist.component.html', + styleUrls: ['./popup-create-or-update-playlist.component.scss'] +}) +export class PopupCreateOrUpdatePlaylistComponent implements OnInit +{ + name: string = "" ; + hasError: boolean = false; + tabNomPlaylist: string[] = []; + errorMessage: string = "" ; + action: string = ""; + + + + constructor( public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data, + private messageService: MessageService) { } + + + ngOnInit(): void + { + this.action = this.data.action; + this.tabNomPlaylist = this.data.tabPlaylist.map( playlist0 => playlist0.name ); + if(this.action === "update") this.name = this.data.playlistName; + } + + + onValider(): void + { + this.checkError(); + if(!this.hasError) + { + if(this.action === "create") + { + this.messageService + .post("playlist/create", {name: this.name}) + .subscribe(retour => this.onValiderCallback(retour), err => this.onValiderCallback(err)); + } + else if(this.action === "update") + { + this.messageService + .put("playlist/update/"+this.data.playlistId, {name: this.name}) + .subscribe(retour => this.onValiderCallback(retour), err => this.onValiderCallback(err)); + } + } + } + + + onValiderCallback(retour): void + { + if(retour.status !== "success") { + console.log(retour); + this.dialogRef.close(null); + } + else { + if(this.action === "create") this.dialogRef.close(retour.data); + else if(this.action === "update") this.dialogRef.close(this.name); + } + } + + + checkError(): void + { + if(this.name === "") { + this.errorMessage = "Le nom ne peut pas être vide" ; + this.hasError = true; + } + else if(this.tabNomPlaylist.includes(this.name)){ + this.errorMessage = "Ce nom est déjà utilisé" ; + this.hasError = true; + } + else { + this.hasError = false; + this.errorMessage = "" ; + } + } + + + onAnnuler(): void + { + this.dialogRef.close(null); + } + +} diff --git a/src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.ts b/src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.ts deleted file mode 100644 index b9ecbbb..0000000 --- a/src/app/user/myPlaylists/popup-create-playlist/popup-create-playlist.component.ts +++ /dev/null @@ -1,95 +0,0 @@ -import {Component, Inject, OnInit} from '@angular/core'; -import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; -import {MessageService} from "../../../utils/services/message/message.service"; -import {PlaylistDB} from "../../../utils/interfaces/playlist"; - - - -@Component({ - selector: 'app-popup-create-playlist', - templateUrl: './popup-create-playlist.component.html', - styleUrls: ['./popup-create-playlist.component.scss'] -}) -export class PopupCreatePlaylistComponent implements OnInit -{ - name: string = "" ; - hasError: boolean = false; - tabNomPlaylist: string[] = []; - errorMessage: string = "" ; - - - constructor( public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data, - private messageService: MessageService) { } - - - ngOnInit(): void - { - this.tabNomPlaylist = this.data.map( playlist0 => playlist0.name ); - } - - - onValider(): void - { - // --- FAUX CODE --- - // - this.checkError(); - if(!this.hasError) - { - const playlist: PlaylistDB = { - _id: "", - userId: "userId", - name: this.name, - videoIds: [], - isActive: true, - createdAt: new Date(), - updatedAt: new Date(), - }; - this.dialogRef.close(playlist); - } - - // --- VRAI CODE --- - /* - this.checkError(); - if(!this.hasError) - { - this.messageService - .sendMessage("user/create/playlist", {title: this.data.title}) - .subscribe(retour => { - - if (retour.status === "error") { - console.log(retour); - this.dialogRef.close(null); - } else { - this.dialogRef.close(retour.data.playlist); - } - }); - } - */ - } - - - checkError(): void - { - if(this.name === "") { - this.errorMessage = "Le nom ne peut pas être vide" ; - this.hasError = true; - } - else if(this.tabNomPlaylist.includes(this.name)){ - this.errorMessage = "Ce nom est déjà utilisé" ; - this.hasError = true; - } - else { - this.hasError = false; - this.errorMessage = "" ; - } - console.log("em:" + this.errorMessage); - } - - - onAnnuler(): void - { - this.dialogRef.close(null); - } - -} diff --git a/src/app/user/myPlaylists/popup-delete-playlist/popup-delete-playlist.component.ts b/src/app/user/myPlaylists/popup-delete-playlist/popup-delete-playlist.component.ts index 0160eb6..2cc06ec 100644 --- a/src/app/user/myPlaylists/popup-delete-playlist/popup-delete-playlist.component.ts +++ b/src/app/user/myPlaylists/popup-delete-playlist/popup-delete-playlist.component.ts @@ -22,7 +22,20 @@ export class PopupDeletePlaylistComponent implements OnInit onValidate(): void { - this.dialogRef.close(true); + this.messageService + .delete("playlist/delete/"+this.playlist._id) + .subscribe( retour => this.onValidateCallback(retour), err => this.onValidateCallback(err)); + } + + onValidateCallback(retour: any): void + { + if(retour.status !== "success") { + console.log(retour); + this.dialogRef.close(null); + } + else { + this.dialogRef.close(true); + } } } diff --git a/src/app/user/myProfil/input-interests-profil/input-interests-profil.component.ts b/src/app/user/myProfil/input-interests-profil/input-interests-profil.component.ts index cb7bc9e..70c60da 100644 --- a/src/app/user/myProfil/input-interests-profil/input-interests-profil.component.ts +++ b/src/app/user/myProfil/input-interests-profil/input-interests-profil.component.ts @@ -6,7 +6,6 @@ import {MessageService} from "../../../utils/services/message/message.service"; import {map, startWith} from "rxjs/operators"; import {MatChipInputEvent} from "@angular/material/chips"; import {MatAutocompleteSelectedEvent} from "@angular/material/autocomplete"; -import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fictitiousUtils/fictitious-utils.service"; @@ -28,8 +27,7 @@ export class InputInterestsProfilComponent implements OnInit @ViewChild('tagInput') tagInput: ElementRef; - constructor( private fictitiousUtilsService: FictitiousUtilsService, - private messageService: MessageService ) {} + constructor( private messageService: MessageService ) {} ngOnInit(): void @@ -38,9 +36,19 @@ export class InputInterestsProfilComponent implements OnInit startWith(null), map((fruit: string | null) => fruit ? this._filter(fruit) : this.allInterests.slice())); - // --- FAUX CODE --- - this.allInterests = this.fictitiousUtilsService.getTags(); - this.allInterests.sort(); + this.messageService + .get("misc/getInterests") + .subscribe( retour => { + + if(retour.status !== "success") { + console.log(retour); + } + else { + this.allInterests = []; + for(let elt of retour.data) this.allInterests.push(elt.interest); + this.allInterests.sort(); + } + }); } diff --git a/src/app/user/myProfil/page-profil-user/page-profil-user.component.ts b/src/app/user/myProfil/page-profil-user/page-profil-user.component.ts index 7544482..1967c8d 100644 --- a/src/app/user/myProfil/page-profil-user/page-profil-user.component.ts +++ b/src/app/user/myProfil/page-profil-user/page-profil-user.component.ts @@ -4,7 +4,8 @@ import {User} from "../../../utils/interfaces/user"; import {MatDialog} from "@angular/material/dialog"; import {MatSnackBar} from "@angular/material/snack-bar"; import {PopupUpdateUserComponent} from "../popup-update-user/popup-update-user.component"; -import {FictitiousUsersService} from "../../../utils/services/fictitiousDatas/fictitiousUsers/fictitious-users.service"; +import {MessageService} from "../../../utils/services/message/message.service"; +import {ProfilService} from "../../../utils/services/profil/profil.service"; @@ -15,18 +16,52 @@ import {FictitiousUsersService} from "../../../utils/services/fictitiousDatas/fi }) export class PageProfilUserComponent implements OnInit { - user: User; + user: User = { + _id: "", + login: "", + hashPass: "", + email: "", + role: { + name: "user", + permission: 0, + }, + profileImageUrl: "", + dateOfBirth: null, + gender: "man", + interests: [], + company: "", + isActive: false, + isAccepted: false, + createdAt: new Date(), + updatedAt: new Date(), + lastConnexion: null + }; constructor( public themeService: ThemeService, - private fictitiousUsersService: FictitiousUsersService, public dialog: MatDialog, - private snackBar: MatSnackBar ) { } + private snackBar: MatSnackBar, + private messageService: MessageService, + private profilService: ProfilService ) { } ngOnInit(): void { - this.user = this.fictitiousUsersService.getUser(); + this.messageService + .get( "user/findOne/"+this.profilService.id) + .subscribe( retour => this.ngOnInitCallback(retour), err => this.ngOnInitCallback(err) ) + } + + + ngOnInitCallback(retour: any) + { + if(retour.status !== "success") { + console.log(retour); + } + else { + this.user = retour.data; + this.profilService.id = retour.data.id; + } } diff --git a/src/app/user/myProfil/popup-update-user/popup-update-user.component.ts b/src/app/user/myProfil/popup-update-user/popup-update-user.component.ts index 5424dca..a4202ad 100644 --- a/src/app/user/myProfil/popup-update-user/popup-update-user.component.ts +++ b/src/app/user/myProfil/popup-update-user/popup-update-user.component.ts @@ -1,6 +1,8 @@ import {Component, Inject, OnInit} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; import {User} from "../../../utils/interfaces/user"; +import {MessageService} from "../../../utils/services/message/message.service"; +import {ProfilService} from "../../../utils/services/profil/profil.service"; @@ -20,7 +22,9 @@ export class PopupUpdateUserComponent implements OnInit constructor( public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data) { } + @Inject(MAT_DIALOG_DATA) public data, + private messageService: MessageService, + private profilService: ProfilService ) { } ngOnInit(): void @@ -55,11 +59,30 @@ export class PopupUpdateUserComponent implements OnInit this.checkField(); if(!this.hasError) { - if(this.changePassword) this.userCopy.hashPass = this.hashage(this.newPassword); - const data = { user: this.userCopy }; + if(this.changePassword) this.userCopy.hashPass = this.newPassword; + const data = { + login: this.userCopy.login, + hashPass: this.userCopy.hashPass, + email: this.userCopy.email, + profileImageUrl: this.userCopy.profileImageUrl, + dateOfBirth: this.userCopy.dateOfBirth, + gender: this.userCopy.gender, + interests: this.userCopy.interests, + }; + this.messageService + .put("user/update/"+this.profilService.id, data) + .subscribe( ret => this.onValiderCallback(ret), err => this.onValiderCallback(err) ); + } + } - // VRAI CODE: envoie au back ... + onValiderCallback(retour: any) + { + if(retour.status !== "success") { + console.log(retour); + this.dialogRef.close(null); + } + else { this.dialogRef.close(this.userCopy); } } @@ -106,17 +129,4 @@ export class PopupUpdateUserComponent implements OnInit this.userCopy.interests = myInterets; } - - // Fonction de hashage (faible) - hashage(input: string): string - { - let hash = 0; - for (let i = 0; i < input.length; i++) { - let ch = input.charCodeAt(i); - hash = ((hash << 5) - hash) + ch; - hash = hash & hash; - } - return hash.toString(); - } - } diff --git a/src/app/user/utils/components/navbar-user/navbar-user.component.ts b/src/app/user/utils/components/navbar-user/navbar-user.component.ts index ce92706..bb2e345 100644 --- a/src/app/user/utils/components/navbar-user/navbar-user.component.ts +++ b/src/app/user/utils/components/navbar-user/navbar-user.component.ts @@ -29,7 +29,7 @@ export class NavbarUserComponent onDeconnexion(): void { this.messageService - .delete('user/logout', {}) + .delete('user/logout') .subscribe(retour => this.onDeconnexionCallback(retour), err => this.onDeconnexionCallback(err)); } diff --git a/src/app/utils/services/message/message.service.ts b/src/app/utils/services/message/message.service.ts index 22b7450..086b447 100644 --- a/src/app/utils/services/message/message.service.ts +++ b/src/app/utils/services/message/message.service.ts @@ -19,10 +19,10 @@ export class MessageService return this.http.post(urlComplete, data, {withCredentials: true}); } - get(url: string, data: any): Observable + get(url: string): Observable { const urlComplete = environment.debutUrl + url ; - return this.http.get(urlComplete, data); + return this.http.get(urlComplete,{withCredentials: true}); } put(url: string, data: any): Observable @@ -31,10 +31,10 @@ export class MessageService return this.http.put(urlComplete, data, {withCredentials: true}); } - delete(url: string, data: any): Observable + delete(url: string): Observable { const urlComplete = environment.debutUrl + url ; - return this.http.delete(urlComplete, data); + return this.http.delete(urlComplete,{withCredentials: true}); } } diff --git a/src/app/utils/services/profil/profil.service.ts b/src/app/utils/services/profil/profil.service.ts index f32dac8..e4d2e2b 100644 --- a/src/app/utils/services/profil/profil.service.ts +++ b/src/app/utils/services/profil/profil.service.ts @@ -5,5 +5,6 @@ import { Injectable } from '@angular/core'; }) export class ProfilService { + public id: string = "" ; public profileImageUrl: string = ""; }