mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 08:47:07 +00:00
Allow silencing API request errors.
The {silent: true} option in the new `opts` argument to the
`api` action does the trick.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
async function api ({state, getters, commit, dispatch}, [resource, init = {}, cb]) {
|
||||
async function api ({state, getters, commit, dispatch}, [resource, init = {}, cb, opts = {}]) {
|
||||
try {
|
||||
commit("queueRequest");
|
||||
if (init && init.hasOwnProperty("body")) {
|
||||
@@ -49,7 +49,9 @@ async function api ({state, getters, commit, dispatch}, [resource, init = {}, cb
|
||||
message = body.message;
|
||||
}
|
||||
}
|
||||
await dispatch('showSnack', [message, "warning"]);
|
||||
if (!opts?.silent) {
|
||||
await dispatch('showSnack', [message, "warning"]);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (err && err.name == "AbortError") return;
|
||||
|
||||
Reference in New Issue
Block a user