From ee67f691d3b59288976f7afccf5d6be013a87d8e Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 14 Oct 2020 18:44:03 +0200 Subject: [PATCH] =?UTF-8?q?Aufr=C3=A4umen=20+=20Login=20Handler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/icons/favicon-16x16.png | Bin 555 -> 0 bytes public/icons/favicon-96x96.png | Bin 3295 -> 0 bytes quasar.conf.js | 8 +- src/{boot => assets}/.gitkeep | 0 src/assets/quasar-logo-full.svg | 191 ------------------------ src/boot/login.ts | 20 +++ src/components/CompositionComponent.vue | 59 -------- src/components/models.ts | 8 - src/index.template.html | 38 ++--- src/layouts/MainLayout.vue | 50 ++++--- src/pages/Index.vue | 49 ------ 11 files changed, 72 insertions(+), 351 deletions(-) delete mode 100644 public/icons/favicon-16x16.png delete mode 100644 public/icons/favicon-96x96.png rename src/{boot => assets}/.gitkeep (100%) delete mode 100644 src/assets/quasar-logo-full.svg create mode 100644 src/boot/login.ts delete mode 100644 src/components/CompositionComponent.vue delete mode 100644 src/components/models.ts delete mode 100644 src/pages/Index.vue diff --git a/public/icons/favicon-16x16.png b/public/icons/favicon-16x16.png deleted file mode 100644 index 436be167f98f402a129b26fdcdc21fc8bdcbd271..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 555 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstUx|vage(c z!@6@aFM*uB0X`wF?gc*o{{R2??|=C0dk;VSKX~x}Umzb0nA6X6?061j{s9Z=%=$e4 z;;$dS|N2k8leFcV^};Xj--Fcs1uF&;zhEr2X`ix|KA3j)XVw1iQ&0Z@O3geABIh1? zbN}t{58wY@e*W{pm;Vk+z5+#q)_fHzx*%71`RetXM;`xgIQ(P7tv|0m|5i7)`tbk1 zPUF?H55FJ0^EG$p*CQuSpFMx!%)9@Ny*EzW`y#Jn$#N1_n{{8*;@1KD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2Pf9`aOu-SB4 z%Hc|RwZR^jnyA(qf>b&LpOq`e?^^p5dg@Um zRXs^{vGmoAZf?zp9`3fwxhu59a4CRAT+bWwr|ysy{fo@Ur0gxQKdBBJH*oA@mD zn~R4V`8w`?&8-s5Nw_#9?w3CmodF$1ue|Ep^;>bVy7t@$MFHP*Gw{T5;52E|b4|HfN(=VNx*h`{M4s%< z43F)}daVrxgGc+6thx!=i|(<QvJ!PPXu=8Q!35$&_7cBD1V>xQQkf_7H z@ABQrv!gOas=Y`Mqx|7w)GWH!v3z-3F+98a?e{(uO MU&k2H1b2x4KP_%wSO5S3 diff --git a/quasar.conf.js b/quasar.conf.js index 73977b8..91adc15 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -9,7 +9,7 @@ /* eslint-disable @typescript-eslint/no-var-requires */ const { configure } = require('quasar/wrappers'); -module.exports = configure(function(ctx) { +module.exports = configure(function (ctx) { return { // https://quasar.dev/quasar-cli/supporting-ts supportTS: { @@ -24,7 +24,7 @@ module.exports = configure(function(ctx) { // app boot file (/src/boot) // --> boot files are part of "main.js" // https://quasar.dev/quasar-cli/boot-files - boot: ['composition-api', 'axios', 'plugins'], + boot: ['composition-api', 'axios', 'login', 'plugins'], // https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css css: ['app.scss'], @@ -64,7 +64,7 @@ module.exports = configure(function(ctx) { // extractCSS: false, // https://quasar.dev/quasar-cli/handling-webpack - extendWebpack(cfg) { + extendWebpack (cfg) { // linting is slow in TS projects, we execute it only for production builds if (ctx.prod) { cfg.module.rules.push({ @@ -191,7 +191,7 @@ module.exports = configure(function(ctx) { // More info: https://quasar.dev/quasar-cli/developing-electron-apps/node-integration nodeIntegration: true, - extendWebpack(/* cfg */) { + extendWebpack (/* cfg */) { // do something with Electron main process Webpack cfg // chainWebpack also available besides this extendWebpack } diff --git a/src/boot/.gitkeep b/src/assets/.gitkeep similarity index 100% rename from src/boot/.gitkeep rename to src/assets/.gitkeep diff --git a/src/assets/quasar-logo-full.svg b/src/assets/quasar-logo-full.svg deleted file mode 100644 index 281d072..0000000 --- a/src/assets/quasar-logo-full.svg +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/boot/login.ts b/src/boot/login.ts new file mode 100644 index 0000000..bcc9d7a --- /dev/null +++ b/src/boot/login.ts @@ -0,0 +1,20 @@ +import { boot } from 'quasar/wrappers'; + +export default boot(({ Vue, router, store }) => { + router.beforeEach((to, from, next) => { + if (to.matched.some(record => record.meta.requiresAuth)) { + // this route requires auth, check if logged in + // if not, redirect to login page. + if (!store.getters.isLoggedIn()) { + next({ + path: '/login', + query: { redirect: to.fullPath } + }) + } else { + next() + } + } else { + next() // make sure to always call next()! + } + }) +}); diff --git a/src/components/CompositionComponent.vue b/src/components/CompositionComponent.vue deleted file mode 100644 index 22b4bd7..0000000 --- a/src/components/CompositionComponent.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - diff --git a/src/components/models.ts b/src/components/models.ts deleted file mode 100644 index 6945920..0000000 --- a/src/components/models.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface Todo { - id: number; - content: string; -} - -export interface Meta { - totalCount: number; -} diff --git a/src/index.template.html b/src/index.template.html index 8157cbf..7eb371e 100644 --- a/src/index.template.html +++ b/src/index.template.html @@ -1,22 +1,24 @@ - - <%= productName %> - - - - - + + <%= productName %> - - - - - - - - -
- - + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index e5d2370..fc5e5e6 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -1,6 +1,9 @@