mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
launch creation from resume page
This commit is contained in:
parent
3ada66ac5f
commit
f8568eb910
@ -30,10 +30,20 @@
|
|||||||
</section >
|
</section >
|
||||||
|
|
||||||
</div >
|
</div >
|
||||||
|
|
||||||
<button
|
<button
|
||||||
[routerLink]="'/step/end'"
|
(click)='submitCreationAndGoToEnd()'
|
||||||
class="btn btn--primary btn--full"
|
class="btn btn--primary btn--full"
|
||||||
i18n="@@confirm" >C'est parfait!
|
i18n="@@confirm" >
|
||||||
|
C'est parfait!
|
||||||
|
<i
|
||||||
|
class='fa fa-paper-plane'
|
||||||
|
*ngIf="!config.loading" ></i >
|
||||||
|
<span
|
||||||
|
class="loading"
|
||||||
|
*ngIf="config.loading" >
|
||||||
|
<i class="fa fa-refresh fa-spin fa-fw" ></i >
|
||||||
|
</span >
|
||||||
</button >
|
</button >
|
||||||
|
|
||||||
<div class="back" >
|
<div class="back" >
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {BaseComponent} from '../base-page/base.component';
|
import {BaseComponent} from '../base-page/base.component';
|
||||||
import {ConfigService} from '../../services/config.service';
|
import {ConfigService} from '../../services/config.service';
|
||||||
|
import {Router} from "@angular/router";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'framadate-resume',
|
selector: 'framadate-resume',
|
||||||
templateUrl: './resume.component.html',
|
templateUrl: './resume.component.html',
|
||||||
styleUrls: ['./resume.component.scss']
|
styleUrls: ['./resume.component.scss']
|
||||||
})
|
})
|
||||||
export class ResumeComponent extends BaseComponent implements OnInit {
|
export class ResumeComponent extends BaseComponent {
|
||||||
|
|
||||||
constructor(public config: ConfigService) {
|
constructor(public config: ConfigService,
|
||||||
|
private router: Router) {
|
||||||
super(config);
|
super(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
submitCreationAndGoToEnd() {
|
||||||
|
this.config.createPoll();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -254,15 +254,18 @@ export class ConfigService extends PollConfig {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* action of the form
|
* launch creation call to the api
|
||||||
*/
|
*/
|
||||||
createPoll() {
|
createPoll() {
|
||||||
// alert('envoi de formulaire pour création de sondage en XHR à faire');
|
this.loading = true;
|
||||||
this.http.get(`${this.baseHref}/`, this.makeHeaders())
|
|
||||||
|
return this.http.get(`${this.baseHref}/`, this.makeHeaders())
|
||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
this.createPollFromConfig(this.getPollConfig())
|
this.createPollFromConfig(this.getPollConfig())
|
||||||
},
|
},
|
||||||
this.handleError
|
(e) => {
|
||||||
|
this.handleError(e)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -274,13 +277,16 @@ export class ConfigService extends PollConfig {
|
|||||||
* @param config
|
* @param config
|
||||||
*/
|
*/
|
||||||
createPollFromConfig(config: any) {
|
createPollFromConfig(config: any) {
|
||||||
this.http.post(`${this.baseHref}/poll`,
|
this.loading= true;
|
||||||
|
return this.http.post(`${this.baseHref}/poll`,
|
||||||
this.makeHeaders({config: config}))
|
this.makeHeaders({config: config}))
|
||||||
.subscribe((res: any) => {
|
.subscribe((res: any) => {
|
||||||
// redirect to the page to administrate the new poll
|
// redirect to the page to administrate the new poll
|
||||||
this.messageService.add({severity: 'success', summary: 'Sondage Créé',});
|
this.messageService.add({severity: 'success', summary: 'Sondage Créé',});
|
||||||
this.selectedPoll = res;
|
this.selectedPoll = res;
|
||||||
this.pollId = res.pollId;
|
this.pollId = res.pollId;
|
||||||
|
this.loading = false;
|
||||||
|
this.router.navigate(['step/end']);
|
||||||
}, (e) => {
|
}, (e) => {
|
||||||
this.handleError(e)
|
this.handleError(e)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user