mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
use fetchResult instead of makeFetch for SocialIssuesAcc.vue component
This commit is contained in:
parent
596833f1a5
commit
046d3ec9f1
@ -149,53 +149,45 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
/* Load others issues in multiselect
|
/* Load other issues in multiselect */
|
||||||
*/
|
|
||||||
this.issueIsLoading = true;
|
this.issueIsLoading = true;
|
||||||
this.actionAreLoaded = false;
|
this.actionAreLoaded = false;
|
||||||
getSocialIssues().then(
|
|
||||||
(response) =>
|
|
||||||
new Promise((resolve) => {
|
|
||||||
this.$store.commit("updateIssuesOther", response.results);
|
|
||||||
|
|
||||||
/* Add in list the issues already associated (if not yet listed)
|
getSocialIssues().then((response) => {
|
||||||
*/
|
/* Add issues to the store */
|
||||||
this.socialIssuesSelected.forEach((issue) => {
|
this.$store.commit("updateIssuesOther", response);
|
||||||
if (
|
|
||||||
this.socialIssuesList.filter(
|
|
||||||
(i) => i.id === issue.id,
|
|
||||||
).length !== 1
|
|
||||||
) {
|
|
||||||
this.$store.commit("addIssueInList", issue);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
/* Remove from multiselect the issues that are not yet in checkbox list
|
/* Add in list the issues already associated (if not yet listed) */
|
||||||
*/
|
this.socialIssuesSelected.forEach((issue) => {
|
||||||
this.socialIssuesList.forEach((issue) => {
|
if (
|
||||||
this.$store.commit("removeIssueInOther", issue);
|
this.socialIssuesList.filter(
|
||||||
}, this);
|
(i) => i.id === issue.id
|
||||||
|
).length !== 1
|
||||||
|
) {
|
||||||
|
this.$store.commit("addIssueInList", issue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/* Filter issues
|
/* Remove from multiselect the issues that are not yet in the checkbox list */
|
||||||
*/
|
this.socialIssuesList.forEach((issue) => {
|
||||||
this.$store.commit("filterList", "issues");
|
this.$store.commit("removeIssueInOther", issue);
|
||||||
|
});
|
||||||
|
|
||||||
/* Add in list the actions already associated (if not yet listed)
|
/* Filter issues */
|
||||||
*/
|
this.$store.commit("filterList", "issues");
|
||||||
this.socialActionsSelected.forEach((action) => {
|
|
||||||
this.$store.commit("addActionInList", action);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
/* Filter issues
|
/* Add in list the actions already associated (if not yet listed) */
|
||||||
*/
|
this.socialActionsSelected.forEach((action) => {
|
||||||
this.$store.commit("filterList", "actions");
|
this.$store.commit("addActionInList", action);
|
||||||
|
});
|
||||||
|
|
||||||
this.issueIsLoading = false;
|
/* Filter actions */
|
||||||
this.actionAreLoaded = true;
|
this.$store.commit("filterList", "actions");
|
||||||
this.updateActionsList();
|
|
||||||
resolve();
|
this.issueIsLoading = false;
|
||||||
}),
|
this.actionAreLoaded = true;
|
||||||
);
|
this.updateActionsList();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* When choosing an issue in multiselect, add it in checkboxes (as selected),
|
/* When choosing an issue in multiselect, add it in checkboxes (as selected),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { fetchResults } from "ChillMainAssets/lib/api/apiMethods.ts";
|
import {fetchResults} from "ChillMainAssets/lib/api/apiMethods.ts";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Endpoint v.2 chill_api_single_accompanying_course__entity
|
* Endpoint v.2 chill_api_single_accompanying_course__entity
|
||||||
@ -33,18 +33,7 @@ const getUserJobs = () => fetchResults("/api/1.0/main/user-job.json");
|
|||||||
|
|
||||||
const getSocialIssues = () => {
|
const getSocialIssues = () => {
|
||||||
const url = `/api/1.0/person/social-work/social-issue.json`;
|
const url = `/api/1.0/person/social-work/social-issue.json`;
|
||||||
return fetch(url).then((response) => {
|
return fetchResults(url);
|
||||||
if (response.ok) {
|
|
||||||
return response.json();
|
|
||||||
}
|
|
||||||
throw {
|
|
||||||
msg: "Error while retriving Social Issues.",
|
|
||||||
sta: response.status,
|
|
||||||
txt: response.statusText,
|
|
||||||
err: new Error(),
|
|
||||||
body: response.body,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const whoami = () => {
|
const whoami = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user