Просмотр исходного кода

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

tags/0.0.1
J 4 лет назад
Родитель
Сommit
3ab7e2658e
5 измененных файлов: 21 добавлений и 15 удалений
  1. 1
    1
      README.md
  2. 14
    7
      frontend/src/main.js
  3. 1
    2
      frontend/src/services/chat.service.js
  4. 3
    3
      frontend/src/utils/survey.js
  5. 2
    2
      frontend/src/views/SurveyView.vue

+ 1
- 1
README.md Просмотреть файл

28
 4. Create tables and populate the database with some test data using `npm run migrate` and `npm run seed` from the `./backend` directory
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
 5. Start the backend using `npm run start`
29
 5. Start the backend using `npm run start`
30
 6. Navigate to the `./frontend` directory and run `npm install`
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
 8. User a web browser to check `http://localhost:3000` 
32
 8. User a web browser to check `http://localhost:3000` 
33
 
33
 
34
 ## :ship: CI/CD
34
 ## :ship: CI/CD

+ 14
- 7
frontend/src/main.js Просмотреть файл

11
  * Check between route changes for login/timeout
11
  * Check between route changes for login/timeout
12
  */
12
  */
13
 router.beforeEach((to, from, next) => {
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
      * Use the loginService to deal with login details
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
         checkLoginStatus(to, next)
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 Просмотреть файл

79
      * @param {event} e
79
      * @param {event} e
80
      */
80
      */
81
     async _onMessage(e) {
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
     async _onPresence(e) {
84
     async _onPresence(e) {
86
         return
85
         return

+ 3
- 3
frontend/src/utils/survey.js Просмотреть файл

27
     async getQuestions() {
27
     async getQuestions() {
28
         this.questions = await fetchQuestions()
28
         this.questions = await fetchQuestions()
29
     }
29
     }
30
-    createSurvey(langFile, roleTree) {
30
+    async createSurvey(langFile, roleTree) {
31
         if(!this.questions.length) {
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
         const steps = this._setSteps(langFile)
36
         const steps = this._setSteps(langFile)

+ 2
- 2
frontend/src/views/SurveyView.vue Просмотреть файл

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

Загрузка…
Отмена
Сохранить