forked from tykayn/funky-framadate-front
⚡ other url to create a poll
This commit is contained in:
parent
8322a9a83a
commit
9900e1ec97
@ -182,8 +182,8 @@ export class ConfigService extends PollConfig {
|
||||
|
||||
|
||||
this.loading = true;
|
||||
this.http.get(`${this.baseHref}/my-polls`,
|
||||
this.makeHeaders({email: this.myEmail}),
|
||||
this.http.get(`${this.baseHref}/send-polls-to-user/${this.myEmail}`,
|
||||
this.makeHeaders(),
|
||||
)
|
||||
.subscribe(res => {
|
||||
// message: 'Trouvé! Allez voir votre boite email',
|
||||
@ -191,8 +191,8 @@ export class ConfigService extends PollConfig {
|
||||
this.loading = false;
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Service Message',
|
||||
detail: 'Via MessageService'
|
||||
summary: 'Succès',
|
||||
detail: `Vos infos de sondages vous ont été transmises. Allez voir votre boite email ${this.myEmail}`
|
||||
});
|
||||
}, (e) => {
|
||||
this.handleError(e)
|
||||
@ -269,16 +269,8 @@ export class ConfigService extends PollConfig {
|
||||
*/
|
||||
createPoll() {
|
||||
this.loading = true;
|
||||
this.createPollFromConfig(this.getPollConfig())
|
||||
|
||||
return this.http.get(`${this.baseHref}/`, this.makeHeaders())
|
||||
.subscribe((res) => {
|
||||
this.createPollFromConfig(this.getPollConfig())
|
||||
},
|
||||
(e) => {
|
||||
this.handleError(e)
|
||||
}
|
||||
)
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
@ -290,7 +282,8 @@ export class ConfigService extends PollConfig {
|
||||
createPollFromConfig(config: any) {
|
||||
this.loading = true;
|
||||
return this.http.post(`${this.baseHref}/poll`,
|
||||
this.makeHeaders({config: config}))
|
||||
config,
|
||||
this.makeHeaders())
|
||||
.subscribe((res: any) => {
|
||||
// redirect to the page to administrate the new poll
|
||||
this.messageService.add({severity: 'success', summary: 'Sondage Créé',});
|
||||
@ -342,7 +335,7 @@ export class ConfigService extends PollConfig {
|
||||
*/
|
||||
updateVote(voteStack: any) {
|
||||
this.http.put(
|
||||
`${this.baseHref}/poll/${this.pollId}/vote`,
|
||||
`${this.baseHref}/vote-stack/${voteStack.id}`,
|
||||
voteStack,
|
||||
this.makeHeaders())
|
||||
.subscribe((res: any) => {
|
||||
@ -363,6 +356,7 @@ export class ConfigService extends PollConfig {
|
||||
if (!comment && this.myComment) {
|
||||
comment = {
|
||||
name: this.myName,
|
||||
email: this.myEmail,
|
||||
date: new Date(),
|
||||
text: this.myComment,
|
||||
}
|
||||
@ -375,7 +369,7 @@ export class ConfigService extends PollConfig {
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Commentaire Créé',
|
||||
detail: 'Via MessageService'
|
||||
detail: comment.text
|
||||
});
|
||||
// empty comment after success
|
||||
this.myComment = '';
|
||||
|
@ -5,7 +5,7 @@ let baseURL = "http://localhost:8000/";
|
||||
const baseURLProd = "https://framadate.org/";
|
||||
const baseURLDemo = "https://framadate-api.cipherbliss.com/";
|
||||
const apiVersion = 1;
|
||||
const testOnDemo = 0;
|
||||
const testOnDemo = 1;
|
||||
if (testOnDemo) {
|
||||
baseURL = baseURLDemo;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user