Procházet zdrojové kódy

:recycle: little router guard test | post-receive hook copy fonts

:recycle: little router guard test | post-receive hook copy fonts | again
brian_lifecycle_docs
j před 2 roky
rodič
revize
bddcbf3afb
2 změnil soubory, kde provedl 17 přidání a 13 odebrání
  1. 8
    4
      deployment/post-receive
  2. 9
    9
      frontend/src/router/guards.js

+ 8
- 4
deployment/post-receive Zobrazit soubor

@@ -7,6 +7,8 @@ commands=(
7 7
     "echo no build needed!"
8 8
     "cd ${REPO}/frontend && rm -f ${REPO}/frontend/package-lock.json && npm install"
9 9
     "npm run build"
10
+    "mkdir ${REPO}/frontend/dist/assets/fonts"
11
+    "cp ${REPO}/frontend/assets/fonts/icomoon.* ${REPO}/frontend/dist/assets/fonts"
10 12
     # "cd ${REPO}/backend && npm run generate && npm run reseed"
11 13
     "pm2 restart siimee_backend -i -1 -n siimee_backend"
12 14
 )
@@ -17,6 +19,8 @@ steps=(
17 19
     "building backend…"
18 20
     "frontend npm install…"
19 21
     "building frontend…"
22
+    "making font directory..."
23
+    "copying fonts..."
20 24
     # "regenerate db data…"
21 25
     "start-up…"
22 26
 )
@@ -24,7 +28,7 @@ SPAN=80
24 28
 COUNT=0
25 29
 hr() {
26 30
     printf "\n"
27
-    
31
+
28 32
     for i in $(seq 0 $SPAN) ; do
29 33
         printf $1
30 34
     done
@@ -39,12 +43,12 @@ print_step() {
39 43
     let COUNT++
40 44
 }
41 45
 run() {
42
-    # Header line 
46
+    # Header line
43 47
     printf "\n\n"
44 48
     printf "** SIIMEE **"
45 49
     hr "="
46 50
     printf "\nStarting POST-RECEIVE…"
47
-    
51
+
48 52
     # Body
49 53
     for step in ${!steps[@]}; do
50 54
         printf "\n"
@@ -52,7 +56,7 @@ run() {
52 56
         eval "${commands[$step]}"
53 57
     done
54 58
 
55
-    # Footer line 
59
+    # Footer line
56 60
     printf "\n"
57 61
     hr "="
58 62
 }

+ 9
- 9
frontend/src/router/guards.js Zobrazit soubor

@@ -4,14 +4,14 @@ import { authenticator, currentProfile } from '../services'
4 4
 const DEV_MODE = import.meta.env.VITE_DEV == 'true'
5 5
 
6 6
 async function log(to) {
7
-    if (DEV_MODE) {
8
-        if (!currentProfile.isLoggedIn || !currentProfile.isComplete) {
9
-            console.info(
10
-                `[Guard Status debug]: Profile: ${currentProfile.id.value} | Login: ${currentProfile.isLoggedIn} | Complete: ${currentProfile.isComplete}`,
11
-            )
12
-        }
13
-        console.info('[Guard Status debug]: being routed to:', to.fullPath)
7
+    // if (DEV_MODE) {
8
+    if (!currentProfile.isLoggedIn || !currentProfile.isComplete) {
9
+        console.info(
10
+            `[Guard Status debug]: Profile: ${currentProfile.id.value} | Login: ${currentProfile.isLoggedIn} | Complete: ${currentProfile.isComplete}`,
11
+        )
14 12
     }
13
+    console.info('[Guard Status debug]: being routed to:', to.fullPath)
14
+    // }
15 15
 }
16 16
 
17 17
 const loginIfToken = async () => {
@@ -41,13 +41,13 @@ const checkLoginStatus = async (destination, nextCb) => {
41 41
         !currentProfile.isLoggedIn &&
42 42
         !currentProfile.isComplete
43 43
     ) {
44
-        nextCb('onboarding')
44
+        nextCb('/onboarding')
45 45
     } else if (
46 46
         destination.meta.requiresCompleteProfile &&
47 47
         destination.meta.requiresAuth &&
48 48
         !currentProfile.isLoggedIn
49 49
     ) {
50
-        nextCb('login')
50
+        nextCb('/login')
51 51
     } else {
52 52
         nextCb()
53 53
     }

Načítá se…
Zrušit
Uložit