Kaynağa Gözat

:recycle: updating readme for nodev isntructions | failing gracefully for certain nodev survey edge cases | tweaked onmessage log response

tags/0.0.1
J 4 yıl önce
ebeveyn
işleme
3ab7e2658e

+ 1
- 1
README.md Dosyayı Görüntüle

@@ -28,7 +28,7 @@ See `./docs`
28 28
 4. Create tables and populate the database with some test data using `npm run migrate` and `npm run seed` from the `./backend` directory
29 29
 5. Start the backend using `npm run start`
30 30
 6. Navigate to the `./frontend` directory and run `npm install`
31
-7. Start the frontend development server with `npm run dev`
31
+7. Start the frontend development server with `npm run dev` or `npm run nodev` if you want to remove restrictions on logging in and profile completeness
32 32
 8. User a web browser to check `http://localhost:3000` 
33 33
 
34 34
 ## :ship: CI/CD

+ 14
- 7
frontend/src/main.js Dosyayı Görüntüle

@@ -11,17 +11,24 @@ const DEV = import.meta.env.VITE_DEV == 'true'
11 11
  * Check between route changes for login/timeout
12 12
  */
13 13
 router.beforeEach((to, from, next) => {
14
+    /**
15
+     * Skip any route guarding with `npm run dev`
16
+     */
17
+    if(DEV) { next() }
18
+
14 19
     /**
15 20
      * Use the loginService to deal with login details
21
+     * Activate with `npm run nodev`
16 22
      */
17
-    console.log('DEV :', DEV)
18
-    if(DEV) {
19
-        next()
20
-    } else {
23
+    else {
21 24
         checkLoginStatus(to, next)
22 25
     }
23 26
 })
24 27
 
25
-const siimee = createApp(App).use(router)
26
-siimee.component('MainNav', MainNav)
27
-siimee.mount('#app')
28
+const run = entry => {
29
+    const siimee = createApp(App).use(router)
30
+    siimee.component('MainNav', MainNav)
31
+    siimee.mount(entry)
32
+}
33
+
34
+run('#app')

+ 1
- 2
frontend/src/services/chat.service.js Dosyayı Görüntüle

@@ -79,8 +79,7 @@ class Chatter {
79 79
      * @param {event} e
80 80
      */
81 81
     async _onMessage(e) {
82
-        console.log(e.message.title)
83
-        console.log(e.message.description)
82
+        console.log(`received message: ${e.message.title} - ${e.message.description}`)
84 83
     }
85 84
     async _onPresence(e) {
86 85
         return

+ 3
- 3
frontend/src/utils/survey.js Dosyayı Görüntüle

@@ -27,10 +27,10 @@ class SurveyFactory {
27 27
     async getQuestions() {
28 28
         this.questions = await fetchQuestions()
29 29
     }
30
-    createSurvey(langFile, roleTree) {
30
+    async createSurvey(langFile, roleTree) {
31 31
         if(!this.questions.length) {
32
-            console.error('Get questions before creating a survey')
33
-            return
32
+            console.error('Attempted to create a survey before getting questions')
33
+            await this.getQuestions()
34 34
         }
35 35
 
36 36
         const steps = this._setSteps(langFile)

+ 2
- 2
frontend/src/views/SurveyView.vue Dosyayı Görüntüle

@@ -121,12 +121,12 @@ export default {
121 121
             )
122 122
         },
123 123
     },
124
-    created() {
124
+    async created() {
125 125
         /**
126 126
          * Before this ever gets called, surveyFactory.questions
127 127
          * must be set by App.created()
128 128
          */
129
-        this.validSurvey = surveyFactory.createSurvey(
129
+        this.validSurvey = await surveyFactory.createSurvey(
130 130
             allSteps['usa'],
131 131
             possible['usa']['roles'],
132 132
         )

Loading…
İptal
Kaydet