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 {
props: {
refresh_issues: context.refresh_issues,
exercice: exercice,
fillIssue: exercice !== null || page.query.get("fill-issue") !== null,
}
@ -36,6 +37,7 @@
import FormIssue from '../components/FormIssue.svelte';
export let refresh_issues = null;
export let exercice = null;
export let fillIssue = false;
let issue = {};
@ -50,6 +52,14 @@
let message = "";
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) {
exercice = null;
issue = {id: _issue.id, description: ''};
@ -76,6 +86,9 @@
issue = { };
exercice = null;
fillIssue = false;
const currentissues = get_store_value(issues);
waitDiff(currentissues.length, 7);
} else {
messageClass = 'danger';