Parcourir la source

: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 il y a 2 ans
Parent
révision
bddcbf3afb
2 fichiers modifiés avec 17 ajouts et 13 suppressions
  1. 8
    4
      deployment/post-receive
  2. 9
    9
      frontend/src/router/guards.js

+ 8
- 4
deployment/post-receive Voir le fichier

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

+ 9
- 9
frontend/src/router/guards.js Voir le fichier

4
 const DEV_MODE = import.meta.env.VITE_DEV == 'true'
4
 const DEV_MODE = import.meta.env.VITE_DEV == 'true'
5
 
5
 
6
 async function log(to) {
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
 const loginIfToken = async () => {
17
 const loginIfToken = async () => {
41
         !currentProfile.isLoggedIn &&
41
         !currentProfile.isLoggedIn &&
42
         !currentProfile.isComplete
42
         !currentProfile.isComplete
43
     ) {
43
     ) {
44
-        nextCb('onboarding')
44
+        nextCb('/onboarding')
45
     } else if (
45
     } else if (
46
         destination.meta.requiresCompleteProfile &&
46
         destination.meta.requiresCompleteProfile &&
47
         destination.meta.requiresAuth &&
47
         destination.meta.requiresAuth &&
48
         !currentProfile.isLoggedIn
48
         !currentProfile.isLoggedIn
49
     ) {
49
     ) {
50
-        nextCb('login')
50
+        nextCb('/login')
51
     } else {
51
     } else {
52
         nextCb()
52
         nextCb()
53
     }
53
     }

Chargement…
Annuler
Enregistrer