From e0832ea3f1ffa4a78e664a4ef588234091421ba2 Mon Sep 17 00:00:00 2001 From: Hans-Peter Herzog Date: Thu, 5 Nov 2020 12:19:22 +0100 Subject: [PATCH] TT#96818 Introduce vue-wait to reduce boilerplate code for request states AC: Can manage loading states without implementing boilerplate store code Can use the Vue.$wait plugin in the context of a vue component Can start a loading context with $wait.start('loading-context') Can check the loading state of a context with $wait.is('loading-context') Can end a loading context with $wait.end('loading-context') Sources: https://github.com/f/vue-wait Change-Id: I4318729e5193bc362b4f13186d3f2f16dac90e8b --- package.json | 3 ++- quasar.conf.js | 3 ++- src/boot/vue-wait.js | 9 +++++++++ yarn.lock | 5 +++++ 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/boot/vue-wait.js diff --git a/package.json b/package.json index ddc5defd..b87eeee2 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,8 @@ "eslint-plugin-standard": "^4.0.0", "eslint-plugin-vue": "^6.1.2", "generate-password": "^1.5.1", - "parseuri": "^0.0.6" + "parseuri": "^0.0.6", + "vue-wait": "1.4.8" }, "browserslist": [ "last 10 Chrome versions", diff --git a/quasar.conf.js b/quasar.conf.js index 932aaeec..bd63dfed 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -28,7 +28,8 @@ module.exports = function (/* ctx */) { 'routes', 'components', 'vue-scrollto', - 'constants' + 'constants', + 'vue-wait' ], // https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css diff --git a/src/boot/vue-wait.js b/src/boot/vue-wait.js new file mode 100644 index 00000000..2d55c002 --- /dev/null +++ b/src/boot/vue-wait.js @@ -0,0 +1,9 @@ +import VueWait from 'vue-wait' + +export default ({ Vue, app }) => { + Vue.use(VueWait) + app.wait = new VueWait({ + useVuex: true, + registerDirective: true + }) +} diff --git a/yarn.lock b/yarn.lock index 0e3c9df9..469cf522 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11963,6 +11963,11 @@ vue-template-es2015-compiler@^1.6.0, vue-template-es2015-compiler@^1.9.0: resolved "https://npm-registry.sipwise.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz#1ee3bc9a16ecbf5118be334bb15f9c46f82f5825" integrity sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw== +vue-wait@1.4.8: + version "1.4.8" + resolved "https://npm-registry.sipwise.com/vue-wait/-/vue-wait-1.4.8.tgz#495b2ef996544c91f8ea14b1fe8d5abe94872655" + integrity sha512-R76ZfqyUqUu/xWFnY6fUV1nDYEublac+cTIeHdZ/+F+XhpxK/kDqIyZPZkNcahXPWs0ZUfLAPWyc/IbxPod6Vg== + vue@2.6.12: version "2.6.12" resolved "https://npm-registry.sipwise.com/vue/-/vue-2.6.12.tgz#f5ebd4fa6bd2869403e29a896aed4904456c9123"