浏览代码

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

tags/0.0.1
J 4 年前
父节点
当前提交
7519f244a1

+ 9
- 0
frontend/package-lock.json 查看文件

697
             "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
697
             "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
698
             "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
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
         "cross-spawn": {
709
         "cross-spawn": {
701
             "version": "7.0.3",
710
             "version": "7.0.3",
702
             "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
711
             "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",

+ 3
- 1
frontend/package.json 查看文件

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

+ 8
- 1
frontend/src/main.js 查看文件

5
 import App from './App.vue'
5
 import App from './App.vue'
6
 import MainNav from './components/MainNav.vue'
6
 import MainNav from './components/MainNav.vue'
7
 
7
 
8
+const DEV = import.meta.env.VITE_DEV == 'true'
9
+
8
 /**
10
 /**
9
  * Check between route changes for login/timeout
11
  * Check between route changes for login/timeout
10
  */
12
  */
12
     /**
14
     /**
13
      * Use the loginService to deal with login details
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
 const siimee = createApp(App).use(router)
25
 const siimee = createApp(App).use(router)

+ 1
- 1
frontend/src/router/guards.js 查看文件

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

+ 2
- 2
frontend/src/views/LoginView.vue 查看文件

22
     methods: {
22
     methods: {
23
         async onSubmit() {
23
         async onSubmit() {
24
             if(!this.form.profileId) console.error('No profile in form')
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
             const toRoute = { name: 'HomeView' }
29
             const toRoute = { name: 'HomeView' }
30
             
30
             

+ 4
- 8
frontend/src/views/SurveyView.vue 查看文件

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

正在加载...
取消
保存