ui: Refresh issues after submit

This commit is contained in:
nemunaire 2021-09-02 17:11:53 +02:00
parent f5f450f456
commit a812a6a5c6

View File

@ -10,6 +10,7 @@
return { return {
props: { props: {
refresh_issues: context.refresh_issues,
exercice: exercice, exercice: exercice,
fillIssue: exercice !== null || page.query.get("fill-issue") !== null, fillIssue: exercice !== null || page.query.get("fill-issue") !== null,
} }
@ -36,6 +37,7 @@
import FormIssue from '../components/FormIssue.svelte'; import FormIssue from '../components/FormIssue.svelte';
export let refresh_issues = null;
export let exercice = null; export let exercice = null;
export let fillIssue = false; export let fillIssue = false;
let issue = {}; let issue = {};
@ -50,6 +52,14 @@
let message = ""; let message = "";
let messageClass = "success"; let messageClass = "success";
function waitDiff(curissues, i) {
refresh_issues((issues) => {
if (i > 0 && (!issues || issues.length <= curissues)) {
setTimeout(waitDiff, 850, curissues, i-1);
}
})
}
function respondTo(_issue) { function respondTo(_issue) {
exercice = null; exercice = null;
issue = {id: _issue.id, description: ''}; issue = {id: _issue.id, description: ''};
@ -76,6 +86,9 @@
issue = { }; issue = { };
exercice = null; exercice = null;
fillIssue = false; fillIssue = false;
const currentissues = get_store_value(issues);
waitDiff(currentissues.length, 7);
} else { } else {
messageClass = 'danger'; messageClass = 'danger';