Browse Source

:sparkles: run dev and run nodev to switch env var for login testing

tags/0.0.1
J 4 years ago
parent
commit
7519f244a1

+ 9
- 0
frontend/package-lock.json View File

@@ -697,6 +697,15 @@
697 697
             "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
698 698
             "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
699 699
         },
700
+        "cross-env": {
701
+            "version": "7.0.3",
702
+            "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
703
+            "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
704
+            "dev": true,
705
+            "requires": {
706
+                "cross-spawn": "^7.0.1"
707
+            }
708
+        },
700 709
         "cross-spawn": {
701 710
             "version": "7.0.3",
702 711
             "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",

+ 3
- 1
frontend/package.json View File

@@ -2,7 +2,8 @@
2 2
     "name": "vite-project",
3 3
     "version": "0.0.0",
4 4
     "scripts": {
5
-        "dev": "vite",
5
+        "nodev": "cross-env VITE_DEV=false vite",
6
+        "dev": "cross-env VITE_DEV=true vite",
6 7
         "build": "vite build",
7 8
         "serve": "vite preview",
8 9
         "lint": "eslint --ext .js,.vue --fix src",
@@ -20,6 +21,7 @@
20 21
         "@vitejs/plugin-vue": "^2.2.4",
21 22
         "@vue/compiler-sfc": "^3.2.31",
22 23
         "autoprefixer": "^10.4.2",
24
+        "cross-env": "^7.0.3",
23 25
         "eslint": "^8.11.0",
24 26
         "eslint-config-prettier": "^8.5.0",
25 27
         "eslint-plugin-vue": "^8.5.0",

+ 8
- 1
frontend/src/main.js View File

@@ -5,6 +5,8 @@ import { checkLoginStatus } from './router/guards'
5 5
 import App from './App.vue'
6 6
 import MainNav from './components/MainNav.vue'
7 7
 
8
+const DEV = import.meta.env.VITE_DEV == 'true'
9
+
8 10
 /**
9 11
  * Check between route changes for login/timeout
10 12
  */
@@ -12,7 +14,12 @@ router.beforeEach((to, from, next) => {
12 14
     /**
13 15
      * Use the loginService to deal with login details
14 16
      */
15
-    checkLoginStatus(to, next)
17
+    console.log('DEV :', DEV)
18
+    if(DEV) {
19
+        next()
20
+    } else {
21
+        checkLoginStatus(to, next)
22
+    }
16 23
 })
17 24
 
18 25
 const siimee = createApp(App).use(router)

+ 1
- 1
frontend/src/router/guards.js View File

@@ -1,8 +1,8 @@
1 1
 import { currentProfile } from '../services'
2 2
 
3
+
3 4
 const checkLoginStatus = (destination, nextCb) => {
4 5
     console.warn('currentProfile logged in:', currentProfile.isLoggedIn())
5
-    console.log('destination:', destination.meta)
6 6
     if (
7 7
         destination.meta.requiresCompleteProfile &&
8 8
         currentProfile.isLoggedIn() &&

+ 2
- 2
frontend/src/views/LoginView.vue View File

@@ -22,9 +22,9 @@ export default {
22 22
     methods: {
23 23
         async onSubmit() {
24 24
             if(!this.form.profileId) console.error('No profile in form')
25
+            
25 26
             /**
26
-             * Default to the HomeView and
27
-             * alter as needed (side-effects!)
27
+             * Default to the HomeView and alter as needed (side-effects!)
28 28
              */
29 29
             const toRoute = { name: 'HomeView' }
30 30
             

+ 4
- 8
frontend/src/views/SurveyView.vue View File

@@ -121,11 +121,11 @@ export default {
121 121
             )
122 122
         },
123 123
     },
124
-    /**
125
-     * Before this ever gets called, surveyFactory.questions
126
-     * must be set by App.created()
127
-     */
128 124
     created() {
125
+        /**
126
+         * Before this ever gets called, surveyFactory.questions
127
+         * must be set by App.created()
128
+         */
129 129
         this.validSurvey = surveyFactory.createSurvey(
130 130
             allSteps['usa'],
131 131
             possible['usa']['roles'],
@@ -137,7 +137,6 @@ export default {
137 137
          * from button-coice or button-multi
138 138
          */
139 139
         onButtonSelect(promptVal) {
140
-            console.log('promptVal :', promptVal)
141 140
             for (const [prompt, val] of Object.entries(promptVal)) {
142 141
                 this[prompt] = val
143 142
                 if (prompt == 'seeking') {
@@ -147,12 +146,9 @@ export default {
147 146
             this.step++
148 147
         },
149 148
         onInputChange(prompt, val) {
150
-            console.log('prompt :>> ', prompt)
151
-            console.log('val :>> ', val)
152 149
             this[prompt] = val
153 150
         },
154 151
         back(prompt) {
155
-            console.log('prompt :>> ', prompt)
156 152
             this[prompt] = ''
157 153
             this.step--
158 154
         },

Loading…
Cancel
Save