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