partie 'beforeConnexion' entierement connectée avec le back
This commit is contained in:
parent
411cea6ff0
commit
cf3c596c7b
4 changed files with 39 additions and 15 deletions
|
|
@ -6,7 +6,8 @@ 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";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-input-interests-register',
|
||||
|
|
@ -26,8 +27,7 @@ export class InputInterestsRegisterComponent implements OnInit
|
|||
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
||||
|
||||
|
||||
constructor( private fictitiousUtilsService: FictitiousUtilsService,
|
||||
private messageService: MessageService ) {}
|
||||
constructor( private messageService: MessageService ) {}
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
|
|
@ -36,9 +36,19 @@ export class InputInterestsRegisterComponent 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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -109,9 +109,9 @@
|
|||
</mat-form-field>
|
||||
|
||||
<!-- interests -->
|
||||
<app-input-interests-profil
|
||||
<app-input-interests-register
|
||||
[myInterests]="user.interests"
|
||||
(eventEmitter)="onEventInputInterests($event)"></app-input-interests-profil>
|
||||
(eventEmitter)="onEventInputInterests($event)"></app-input-interests-register>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -53,21 +53,23 @@ export class PageRegisterComponent
|
|||
this.checkField();
|
||||
if(!this.hasError)
|
||||
{
|
||||
if(this.user.role.name === "user") this.user.role.permission = 0;
|
||||
else this.user.role.permission = 5;
|
||||
this.user.hashPass = this.password;
|
||||
let data: any = Object.assign({}, this.user);
|
||||
if(this.user.role.name === "user") data.role = "user" ;
|
||||
else data.role = "advertiser";
|
||||
data.hashPass = this.password;
|
||||
this.messageService
|
||||
.post('user/create', this.user)
|
||||
.post('user/create', data)
|
||||
.subscribe(retour => this.onEnregistrerCallback(retour), err => this.onEnregistrerCallback(err));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Gestion de la réponde du backend
|
||||
// Gestion de la réponse du backend
|
||||
onEnregistrerCallback(retour): void
|
||||
{
|
||||
console.log(retour);
|
||||
if(retour.status !== "success") {
|
||||
console.log(retour);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export interface User
|
|||
profileImageUrl: string,
|
||||
dateOfBirth: Date,
|
||||
gender: string,
|
||||
interests: string[],
|
||||
interests: any[],
|
||||
company: string,
|
||||
isActive: boolean,
|
||||
isAccepted: boolean,
|
||||
|
|
@ -19,3 +19,15 @@ export interface User
|
|||
createdAt: Date,
|
||||
updatedAt: Date
|
||||
}
|
||||
|
||||
|
||||
interface VideoCategorie
|
||||
{
|
||||
id: number
|
||||
interest: string
|
||||
categories: {
|
||||
id: string
|
||||
name: string
|
||||
source: string
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue