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 >
|
||||
|
||||
</div >
|
||||
|
||||
<button
|
||||
[routerLink]="'/step/end'"
|
||||
(click)='submitCreationAndGoToEnd()'
|
||||
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 >
|
||||
|
||||
<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 {ConfigService} from '../../services/config.service';
|
||||
import {Router} from "@angular/router";
|
||||
|
||||
@Component({
|
||||
selector: 'framadate-resume',
|
||||
templateUrl: './resume.component.html',
|
||||
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);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
submitCreationAndGoToEnd() {
|
||||
this.config.createPoll();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -254,17 +254,20 @@ export class ConfigService extends PollConfig {
|
||||
|
||||
|
||||
/**
|
||||
* action of the form
|
||||
* launch creation call to the api
|
||||
*/
|
||||
createPoll() {
|
||||
// alert('envoi de formulaire pour création de sondage en XHR à faire');
|
||||
this.http.get(`${this.baseHref}/`, this.makeHeaders())
|
||||
this.loading = true;
|
||||
|
||||
return this.http.get(`${this.baseHref}/`, this.makeHeaders())
|
||||
.subscribe((res) => {
|
||||
this.createPollFromConfig(this.getPollConfig())
|
||||
},
|
||||
this.handleError
|
||||
(e) => {
|
||||
this.handleError(e)
|
||||
}
|
||||
)
|
||||
;
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
@ -274,13 +277,16 @@ export class ConfigService extends PollConfig {
|
||||
* @param config
|
||||
*/
|
||||
createPollFromConfig(config: any) {
|
||||
this.http.post(`${this.baseHref}/poll`,
|
||||
this.loading= true;
|
||||
return this.http.post(`${this.baseHref}/poll`,
|
||||
this.makeHeaders({config: config}))
|
||||
.subscribe((res: any) => {
|
||||
// redirect to the page to administrate the new poll
|
||||
this.messageService.add({severity: 'success', summary: 'Sondage Créé',});
|
||||
this.selectedPoll = res;
|
||||
this.pollId = res.pollId;
|
||||
this.loading = false;
|
||||
this.router.navigate(['step/end']);
|
||||
}, (e) => {
|
||||
this.handleError(e)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user