summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormei23 <m@m544.net>2020-04-02 05:41:03 +0900
committermei23 <m@m544.net>2020-04-02 05:41:03 +0900
commit331305e6c74a5e1d567276381a50877f3eddc30a (patch)
tree0ab4cbd2406f06232e031ec57c3a88f5c32c9cbc /src
parentMerge pull request #6208 from syuilo/patch/autogen/v11 (diff)
downloadmisskey-331305e6c74a5e1d567276381a50877f3eddc30a.tar.gz
misskey-331305e6c74a5e1d567276381a50877f3eddc30a.tar.bz2
misskey-331305e6c74a5e1d567276381a50877f3eddc30a.zip
lint
Diffstat (limited to 'src')
-rw-r--r--src/client/store.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/store.ts b/src/client/store.ts
index 6d007493d8..5e98092c23 100644
--- a/src/client/store.ts
+++ b/src/client/store.ts
@@ -130,16 +130,16 @@ export default () => new Vuex.Store({
ctx.state.spinner.setAttribute('id', 'wait');
document.body.appendChild(ctx.state.spinner);
}
-
+
const onFinally = () => {
if (--ctx.state.pendingApiRequestsCount === 0) ctx.state.spinner.parentNode.removeChild(ctx.state.spinner);
};
-
+
const promise = new Promise((resolve, reject) => {
// Append a credential
if (ctx.getters.isSignedIn) (data as any).i = ctx.state.i.token;
if (token) (data as any).i = token;
-
+
// Send request
fetch(endpoint.indexOf('://') > -1 ? endpoint : `${apiUrl}/${endpoint}`, {
method: 'POST',
@@ -148,7 +148,7 @@ export default () => new Vuex.Store({
cache: 'no-cache'
}).then(async (res) => {
const body = res.status === 204 ? null : await res.json();
-
+
if (res.status === 200) {
resolve(body);
} else if (res.status === 204) {
@@ -158,9 +158,9 @@ export default () => new Vuex.Store({
}
}).catch(reject);
});
-
+
promise.then(onFinally, onFinally);
-
+
return promise;
}
},