Pārlūkot izejas kodu

:recycle: reorg of app components | keeping pid at root level and trickle down

tags/0.0.1
toj 4 gadus atpakaļ
vecāks
revīzija
2fb9f38a84

+ 200
- 5483
frontend/package-lock.json
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 35
- 2
frontend/src/App.vue Parādīt failu

@@ -1,12 +1,45 @@
1 1
 <template lang="pug">
2
-router-view
2
+SideBar(v-if="showSidebar" :pid="pid" @updatePid="setPid" @hide="showSidebar = false")
3
+RouterView(:pid="pid" @show-sidebar="showSidebar = true")
3 4
 </template>
4 5
 
5 6
 <script>
6 7
 import * as sss from '@/sss/import.css'
7 8
 
9
+import SideBar from './components/SideBar.vue'
10
+
11
+import { Chatter, StonkAlert } from './services'
12
+
13
+const DEFAULT_PID = 45
14
+
8 15
 export default {
9
-    name: 'app'
16
+    components: { SideBar },
17
+    data: () => ({
18
+        pid: null,
19
+        showSidebar: false
20
+    }),
21
+    created() {
22
+        this.setPid()
23
+        this.setupChatter()
24
+        this.setupToaster()
25
+    },
26
+    methods: {
27
+        setPid(pid) {
28
+            this.pid = pid ? parseInt(pid) : DEFAULT_PID
29
+        },
30
+
31
+        // For push notifications and chat 
32
+        setupToaster() {
33
+            const t = new StonkAlert(this.pid)
34
+        },
35
+        setupChatter() {
36
+            const c = new Chatter()
37
+            const testAccountUUID = import.meta.env.VITE_TEST_ACCOUNT_UUID
38
+            c.setup(testAccountUUID)
39
+            console.log('---')
40
+        },
41
+    },
42
+    
10 43
 }
11 44
 </script>
12 45
 

+ 5
- 3
frontend/src/components/MainNav.vue Parādīt failu

@@ -1,9 +1,10 @@
1 1
 <template lang="pug">
2 2
 nav#main-header.w-full.f-row.around.p-2
3
-    router-link.header__icon.mobile--only(:to="`/matches?pid=${pid}`") {{pid}} matches
3
+    button(@click="$emit('show-sidebar')") show sidebar
4
+    router-link.header__icon.mobile--only(:to="`/matches`") matches
4 5
     router-link.header__icon(to='/') home
5
-    router-link.header__icon.mobile--only(:to="`/profile?pid=${pid}`") {{pid}} profile
6
-    router-link.header__icon.mobile--only(:to="`/survey?pid=${pid}`") {{pid}} survey
6
+    router-link.header__icon.mobile--only(:to="`/profile`") profile
7
+    router-link.header__icon.mobile--only(:to="`/survey`") survey
7 8
 </template>
8 9
 
9 10
 <script>
@@ -11,6 +12,7 @@ export default {
11 12
     name: 'MainNav',
12 13
     props: {
13 14
         pid: {
15
+            type: Number,
14 16
             required: true
15 17
         }
16 18
     }

frontend/src/components/Sidebar.vue → frontend/src/components/SideBar.vue Parādīt failu

@@ -1,10 +1,7 @@
1 1
 <template lang="pug">
2 2
 aside.sidebar.p-1.f-col.between
3 3
     h3 Profile: {{ pid }}
4
-    .search
5
-        input
6
-        label search
7
-
4
+    button(@click="$emit('hide')") hide
8 5
     messages(:title="title" :users="users")
9 6
     .spacer.f-grow
10 7
     .temp-control-box.f-row.start.center
@@ -19,7 +16,8 @@ export default {
19 16
     components: { messages }, 
20 17
     props: {
21 18
         pid: {
22
-            required: true
19
+            required: true,
20
+            type: Number
23 21
         }
24 22
     },
25 23
     data: () => ({

+ 50
- 23
frontend/src/components/form.vue Parādīt failu

@@ -12,12 +12,12 @@
12 12
             h3 {{ prompt.question }}?
13 13
             .response-wrapper(v-if='prompt.type === "input-string"')
14 14
                 label {{ prompt.type }}
15
-                input(v-model='answers[`${prompt.id}-${makeKebob(prompt.question)}`]')
15
+                input(v-model='answers[makeKey(prompt)]')
16 16
             .response-wrapper(v-else-if='prompt.type === "tag-cloud"')
17 17
                 label {{ prompt.type }}
18 18
                 button.p-0(
19
-                    :disabled='response == answers[`${prompt.id}-${makeKebob(prompt.question)}`]'
20
-                    :prompt-question='`${prompt.id}-${makeKebob(prompt.question)}`'
19
+                    :disabled='response == answers[makeKey(prompt)]'
20
+                    :prompt-question='makeKey(prompt)'
21 21
                     @click='respondFromTag'
22 22
                     v-for='response in prompt.responses'
23 23
                 ) {{ response }}
@@ -33,33 +33,32 @@
33 33
                         :name='response'
34 34
                         :true-value='response'
35 35
                         false-value=''
36
-                        v-model='answers[`${prompt.id}-${makeKebob(prompt.question)}`]')
36
+                        v-model='answers[makeKey(prompt)]')
37 37
                     label(:for='response') {{ response }}
38 38
             //- Slider from -3 to 0 to +3 (increments of 1)
39
-            .response-wrapper(v-else-if='prompt.type === "slide"')
39
+            .response-wrapper(v-else-if='prompt.type === "input-slide"')
40 40
                 label {{ prompt.type }}
41 41
                 input(
42 42
                     type='range'
43 43
                     min='-3'
44 44
                     max='3'
45
-                    v-model='answers[`${prompt.id}-${makeKebob(prompt.question)}`]')
46
-                span {{ answers[`${prompt.id}-${makeKebob(prompt.question)}`] }}
45
+                    v-model='answers[makeKey(prompt)]')
46
+                span {{ answers[makeKey(prompt)] }}
47 47
 
48 48
     footer.f-row.w-full
49 49
         button.p-1(:disabled='state.step == 1' @click='back') back
50 50
         button.p-1(:disabled='state.step == form.length' @click='next') next
51 51
         button.p-1(:disabled='state.step != form.length' @click='next') save
52 52
         .f-grow
53
-        p step: {{ state.step }} of {{ form.length }}
53
+        p step: {{ state.step }} of {{ form.length }} for {{ pid }}
54 54
 </template>
55 55
 
56 56
 <script setup>
57 57
 import Joi from 'joi'
58 58
 import { validatorMapping, makeKebob } from '@/utils'
59
-import { defineProps, reactive, ref } from 'vue'
60
-import { saveSurveyByProfileID, scoreSurveyByProfileId } from '../services/survey.service'
61
-
62
-const slidevalue = ref('0')
59
+import { defineProps, reactive } from 'vue'
60
+import { saveSurveyByProfileId, scoreSurveyByProfileId } from '../services/survey.service'
61
+import { scoreVals } from '../../../backend/db/data-generator/config.json'
63 62
 
64 63
 const props = defineProps({
65 64
     form: {
@@ -67,9 +66,14 @@ const props = defineProps({
67 66
         required: true,
68 67
     },
69 68
     pid: {
70
-        required: true
69
+        required: true,
70
+        type: Number
71 71
     }
72 72
 })
73
+const makeKey = prompt => {
74
+    return `${prompt.id}-${prompt.type}-${makeKebob(prompt.question)}`
75
+}
76
+
73 77
 /**
74 78
  * Our form is comprised of steps, and each step has a series of questions
75 79
  */
@@ -101,41 +105,64 @@ const isValid = step => {
101 105
     const schema = {}
102 106
     const answeredThisStep = {}
103 107
     props.form[step].forEach(prompt => {
104
-        const key = `${prompt.id}-${makeKebob(prompt.question)}`
108
+        const key = makeKey(prompt)
105 109
         schema[key] = validatorMapping[prompt.type]
106 110
         answeredThisStep[key] = answers[key]
107 111
     })
108 112
     return Joi.object(schema).validate(answeredThisStep)
109 113
 }
114
+/**
115
+ * Vary the final answer format by input type
116
+ */
117
+const formatAnswer = (inputType, answer) => {
118
+    let formattedAnswer = answer
119
+    if(inputType == 'slide')  {
120
+        const offset = (scoreVals.length - 1) / 2
121
+        formattedAnswer = scoreVals[offset + parseInt(answer)].toString()
122
+    }
123
+    return formattedAnswer
124
+}
110 125
 /**
111 126
  * Save or take the-nNext step in the form
112 127
  */
128
+const getInputTypeFromKey = k => {
129
+    const inputIndex = k.split('-').indexOf('input')
130
+    return k.split('-')[inputIndex + 1]
131
+}
132
+
113 133
 const next = async e => {
114 134
     const validity = isValid(state.step - 1)
115
-    if (validity.error) return console.error(validity.error)
135
+    if (validity.error) console.error(validity.error)
136
+
116 137
     if (state.step === props.form.length) {
138
+        // Make key map of each prompt.id
117 139
         const questiontoResponseKeyId = {}
118 140
         props.form.forEach(step => {
119 141
             step.forEach(prompt => {
120
-                questiontoResponseKeyId[`${prompt.id}-${makeKebob(prompt.question)}`] = prompt.id
121
-                })
142
+                questiontoResponseKeyId[makeKey(prompt)] = prompt.id
143
+            })
122 144
         })
123
-        const idWithResponseVal = []
124
-        Object.keys(answers).forEach(answerKey => {
125
-            idWithResponseVal.push({
145
+
146
+        const idWithResponseVal = Object.keys(answers).map(answerKey => {
147
+            return {
126 148
                 response_key_id: questiontoResponseKeyId[answerKey],
127
-                val: answers[answerKey],
128
-            })
149
+                val: formatAnswer(
150
+                    getInputTypeFromKey(answerKey),
151
+                    answers[answerKey]
152
+                )
153
+            }
129 154
         })
130 155
 
131 156
         const maxDistance = 100
132 157
         
133 158
         if(!props.pid) return console.error(`no pid: ${props.pid}`)
134 159
 
135
-        saveSurveyByProfileID(idWithResponseVal, props.pid)
160
+        saveSurveyByProfileId(idWithResponseVal, props.pid)
136 161
         alert('Responses submitted!')
162
+        
137 163
         resetAnswers()
138 164
         scoreSurveyByProfileId(props.pid, maxDistance)
165
+
139 166
         state.step = 1
140 167
     } else if (state.step < props.form.length) {
141 168
         state.step++

+ 5
- 1
frontend/src/main.js Parādīt failu

@@ -2,6 +2,8 @@ import { createApp } from 'vue'
2 2
 import App from './App.vue'
3 3
 import router from './router'
4 4
 
5
+import MainNav from './components/MainNav.vue'
6
+
5 7
 router.beforeEach((to, from, next) => {
6 8
     const requiresAuth = false
7 9
     const requiresProfile = true
@@ -21,4 +23,6 @@ router.beforeEach((to, from, next) => {
21 23
     // }
22 24
 })
23 25
 
24
-createApp(App).use(router).mount('#app')
26
+const siimee = createApp(App).use(router)
27
+siimee.component('MainNav', MainNav)
28
+siimee.mount('#app')

+ 4
- 3
frontend/src/router/index.js Parādīt failu

@@ -1,5 +1,6 @@
1 1
 import { createRouter, createWebHistory } from 'vue-router'
2
-import home from '../views/home.vue'
2
+
3
+import HomeView from '../views/HomeView.vue'
3 4
 import Profile from '../views/Profile.vue'
4 5
 import Matches from '../views/Matches.vue'
5 6
 import Chats from '../views/Chats.vue'
@@ -10,9 +11,9 @@ import Survey from '../views/Survey.vue'
10 11
 const routes = [
11 12
     {
12 13
         path: '/',
13
-        component: home,
14
+        component: HomeView,
14 15
         name: 'HomeView',
15
-        meta: { requiresAuth: true, requiresProfile: true },
16
+        meta: { requiresAuth: true, requiresProfile: true }
16 17
     },
17 18
     {
18 19
         path: '/profile',

+ 8
- 3
frontend/src/services/survey.service.js Parādīt failu

@@ -22,10 +22,14 @@ const fetchSurveyByProfileId = async profileId => {
22 22
     // Add the questions into each step, dividing into questionsPerStep
23 23
     for (let i = 0; i < myquestions.length; i++) {
24 24
         const question = myquestions[i]
25
+
26
+        // Set the input type based on category
27
+        const type = question.response_key_category == 'locationPref' ? 'input-string' : 'input-slide'
28
+        
25 29
         // Reformats myquestions into the format we want
26 30
         const reformatted = {
27 31
             id: question.response_key_id,
28
-            type: 'input-string',
32
+            type,
29 33
             question: question.response_key_prompt,
30 34
             responses: null,
31 35
             description: question.response_key_description,
@@ -38,10 +42,11 @@ const fetchSurveyByProfileId = async profileId => {
38 42
         }
39 43
     }
40 44
     const mysurvey = new Survey(allsteps)
45
+    console.log('mysurvey :>> ', mysurvey);
41 46
     return mysurvey
42 47
 }
43 48
 
44
-const saveSurveyByProfileID = async (surveyResponses, profileId) => {
49
+const saveSurveyByProfileId = async (surveyResponses, profileId) => {
45 50
     surveyResponses.forEach(responseKeyIdwithVal => {
46 51
         const keyId = responseKeyIdwithVal.response_key_id
47 52
         const val = responseKeyIdwithVal.val
@@ -77,7 +82,7 @@ const scoreSurveyByProfileId = async (profileId, maxDistance) => {
77 82
 
78 83
 export {
79 84
     fetchSurveyByProfileId,
80
-    saveSurveyByProfileID,
85
+    saveSurveyByProfileId,
81 86
     updateSurveyByProfileId,
82 87
     scoreSurveyByProfileId,
83 88
 }

+ 0
- 28
frontend/src/utils/forms.js Parādīt failu

@@ -1,28 +0,0 @@
1
-const profileForm = [
2
-    [
3
-        {
4
-            type: 'input-string',
5
-            id: 1,
6
-            responses: null,
7
-        },
8
-        {
9
-            type: 'tag-cloud',
10
-            id: 2,
11
-            responses: ['red', 'blue', 'green', 'white', 'black'],
12
-        },
13
-    ],
14
-    [
15
-        {
16
-            type: 'input-string',
17
-            id: 3,
18
-            responses: null,
19
-        },
20
-        {
21
-            type: 'input-string',
22
-            id: 4,
23
-            responses: null,
24
-        },
25
-    ],
26
-]
27
-
28
-export { profileForm }

+ 1
- 1
frontend/src/utils/index.js Parādīt failu

@@ -9,7 +9,7 @@ const validatorMapping = {
9 9
     'input-string': Joi.string(),
10 10
     'tag-cloud': Joi.string(),
11 11
     'checklist': Joi.string(),
12
-    'slide': Joi.string(),
12
+    'input-slide': Joi.string(),
13 13
 }
14 14
 
15 15
 const makeKebob = input => {

+ 3
- 0
frontend/src/utils/login.js Parādīt failu

@@ -2,6 +2,7 @@ import { fetchQueueByProfileId } from '../services'
2 2
 
3 3
 class Login {
4 4
     constructor() {
5
+        this.loading = true
5 6
         this.currentProfileId = null
6 7
         this.survey = null
7 8
         this.queue = null
@@ -22,10 +23,12 @@ class Login {
22 23
     }
23 24
 
24 25
     async getQueue() {
26
+        this.loading = true
25 27
         try {
26 28
             const queueList = await fetchQueueByProfileId(this.currentProfileId)
27 29
             const formatted = this._reformatProfiles(queueList)
28 30
             this._setQueue(formatted)
31
+            this.loading = false
29 32
         } catch (err) {
30 33
             console.error('---')
31 34
             this.queue = null

frontend/src/views/home.vue → frontend/src/views/HomeView.vue Parādīt failu

@@ -1,79 +1,61 @@
1 1
 <template lang="pug">
2
-sidebar(v-if='!loading' :pid="pid" @updatePid="setPid")
3 2
 main.f-col.start.w-full
4
-    article#home(v-if='!loading')
3
+    article#home(v-if="!loading")
5 4
         h1 Queue Page
6
-        profile-card-list(:profiles='swipables' :pid='parseInt(pid)' @reload-queue='getQueue')
5
+        ProfileCardList(:profiles="cards" :pid="pid" @reload-queue="getQueue")
7 6
     p(v-else) Loading...
8
-    main-nav(v-if='!loading' :pid="pid")
7
+    MainNav(:pid="pid" @show-sidebar="$emit('show-sidebar')")
9 8
 </template>
10 9
 
11 10
 <script>
12
-import sidebar from '../components/Sidebar.vue'
13
-import mainNav from '../components/MainNav.vue'
14
-import profileCardList from '../components/ProfileCardList.vue'
11
+import ProfileCardList from '../components/ProfileCardList.vue'
15 12
 
16
-import { Chatter, StonkAlert } from '../services'
17
-import { loginHandler, authHandler } from '../utils'
18
-
19
-import batch_10 from '../../../backend/db/generated/_batch_10.js.ref'
20
-import batch_20 from '../../../backend/db/generated/_batch_20.js.ref'
21
-import batch_30 from '../../../backend/db/generated/_batch_30.js.ref'
22
-
23
-const DEFAULT_PID = 45
13
+import { fetchQueueByProfileId } from '../services'
24 14
 
25 15
 export default {
26 16
     name: 'HomeView',
27
-    components: { profileCardList, sidebar, mainNav },
17
+    components: { ProfileCardList },
18
+    props: {
19
+        pid: {
20
+            type: Number,
21
+            required: true
22
+        }
23
+    },
28 24
     data: () => ({
29
-        swipables: [],
25
+        cards: [],
30 26
         loading: true,
31
-        pid: null
32 27
     }),
33
-    mounted() {
34
-        // Uncomment below to use API
35
-        let pid
36
-        if(!loginHandler.currentProfileId) {
37
-            pid  = authHandler.currentUser?.pid || DEFAULT_PID
38
-        } else {
39
-            pid = loginHandler.currentProfileId
28
+    watch: {
29
+        pid() {
30
+            this.getQueue()
40 31
         }
41
-        this.setPid(pid)
42
-
43
-        // Uncomment below to use for batch file data
44
-        // this.processProfilesFromBatch(this.parseBatch([batch_10, batch_20, batch_30]))
45
-
46
-        this.setupChatter()
47
-        this.setupToaster()
32
+    },
33
+    async created() {
34
+        await this.getQueue()
48 35
     },
49 36
     methods: {
50
-        setPid(pid) {
51
-            loginHandler.login(pid)
52
-            this.pid = loginHandler.currentProfileId
53
-            this.getQueue()
37
+         _reformatProfiles(profiles) {
38
+            return profiles.map(profile => {
39
+                return {
40
+                    pid: profile.profile_id,
41
+                    name: profile.user_name,
42
+                    avatar: profile.user_media,
43
+                }
44
+            })
54 45
         },
55 46
         async getQueue() {
56 47
             this.loading = true
57 48
             try {
58
-                await loginHandler.getQueue()
59
-                this.swipables = loginHandler.queue
49
+                const queueList = await fetchQueueByProfileId(this.pid)
50
+                this.cards = this._reformatProfiles(queueList)
60 51
             } catch (err) {
61 52
                 console.error(err)
62 53
             }
63 54
             this.loading = false
64 55
         },
65
-        // For push notifications and chat 
66
-        setupToaster() {
67
-            const t = new StonkAlert(this.pid)
68
-        },
69
-        setupChatter() {
70
-            const c = new Chatter()
71
-            const testAccountUUID = import.meta.env.VITE_TEST_ACCOUNT_UUID
72
-            c.setup(testAccountUUID)
73
-            console.log('---')
74
-        },
56
+        
75 57
         // For Batch Data Parsing & Processing
76
-        parseBatch(allBatches) {
58
+        _parseBatch(allBatches) {
77 59
             const finished = { profiles: [], users: [], responses: [] }
78 60
             allBatches.forEach(batch => {
79 61
                 const split = batch.value.split('\n')
@@ -87,7 +69,7 @@ export default {
87 69
             // console.log('parsed batch', finished)
88 70
             return finished
89 71
         },
90
-        processProfilesFromBatch(parsed) {
72
+        _processProfilesFromBatch(parsed) {
91 73
             const findUser = profile => {
92 74
                 return parsed.users.filter(u => u.user_id == profile.user_id)[0]
93 75
             }

+ 10
- 14
frontend/src/views/Matches.vue Parādīt failu

@@ -1,24 +1,24 @@
1 1
 <template lang="pug">
2
-sidebar(:pid="pid")
3 2
 main.f-col.start.w-full
4 3
     article.match(v-if='!loading')
5 4
         h1 Match Page
6
-        profile-card-list(:profiles='profiles' :pid='parseInt(pid)' :is-grid="true")
7
-    main-nav(:pid="pid")
5
+        ProfileCardList(:profiles='profiles' :pid='parseInt(pid)' :is-grid="true")
6
+    MainNav(:pid="pid" @show-sidebar="$emit('show-sidebar')")
8 7
 </template>
9 8
 
10 9
 <script>
11
-import sidebar from '../components/Sidebar.vue'
12
-import mainNav from '../components/MainNav.vue'
13
-import profileCardList from '../components/ProfileCardList.vue'
10
+import ProfileCardList from '../components/ProfileCardList.vue'
14 11
 import { loginHandler } from '../utils'
15 12
 import { fetchMembershipsByProfileId } from '../services'
16 13
 
17
-// import icon from '@/components/icon.vue'
18
-// import card from '@/components/card.vue'
19
-
20 14
 export default {
21
-    components: { profileCardList, sidebar, mainNav },
15
+    components: { ProfileCardList },
16
+    props: {
17
+        pid: {
18
+            type: Number,
19
+            required: true
20
+        }
21
+    },
22 22
     data: () => ({
23 23
         matches: null,
24 24
         loading: true
@@ -33,16 +33,12 @@ export default {
33 33
                     name: m.profile.user_name,
34 34
                 }
35 35
             })
36
-        },
37
-        pid: () => {
38
-            return loginHandler.currentProfileId
39 36
         }
40 37
     },
41 38
     methods: {
42 39
         async getMatches() {
43 40
             this.loading = true
44 41
             try {
45
-                console.log('loginHandler.currentProfileId :', loginHandler.currentProfileId)
46 42
                 this.matches = await fetchMembershipsByProfileId(this.pid)
47 43
             } catch (err) {
48 44
                 console.error(err)

+ 6
- 11
frontend/src/views/Profile.vue Parādīt failu

@@ -1,5 +1,4 @@
1 1
 <template lang="pug">
2
-sidebar
3 2
 main.f-col.start.w-full
4 3
     article#profile
5 4
         h1 Profile Page
@@ -7,13 +6,14 @@ main.f-col.start.w-full
7 6
 </template>
8 7
 
9 8
 <script>
10
-import sidebar from '../components/Sidebar.vue'
11
-import mainNav from '../components/MainNav.vue'
12
-import { loginHandler } from '../utils'
13
-
14 9
 export default {
15 10
     name: 'Profile',
16
-    components: { sidebar, mainNav },
11
+    props: {
12
+        pid: {
13
+            type: Number,
14
+            required: true
15
+        }
16
+    },
17 17
     data() {
18 18
         return {
19 19
             requesting: false,
@@ -25,11 +25,6 @@ export default {
25 25
             },
26 26
         }
27 27
     },
28
-    computed: {
29
-        pid: () => {
30
-            return loginHandler.currentProfileId
31
-        }
32
-    },
33 28
     created() {
34 29
         this.getUser()
35 30
     },

+ 12
- 15
frontend/src/views/Survey.vue Parādīt failu

@@ -1,34 +1,31 @@
1 1
 <template lang="pug">
2
-sidebar(:pid="pid")
3 2
 main.f-col.start.w-full
4 3
     article.match
5 4
         h1 Survey Page
6
-        siimeform(v-if="validSurvey && validSurvey.steps" :form="validSurvey.steps" :pid="pid")
7
-    main-nav(:pid="pid")
5
+        SurveyForm(v-if="validSurvey && validSurvey.steps" :form="validSurvey.steps" :pid="pid")
6
+    MainNav(:pid="pid" @show-sidebar="$emit('show-sidebar')")
8 7
 </template>
9 8
 
10 9
 <script>
11
-import siimeform from '../components/form.vue'
12
-import sidebar from '../components/Sidebar.vue'
13
-import mainNav from '../components/MainNav.vue'
10
+import SurveyForm from '../components/form.vue'
14 11
 import { fetchSurveyByProfileId } from '../services'
15
-import { loginHandler } from '../utils'
16 12
 
17 13
 export default {
18
-    components: { siimeform, sidebar, mainNav },
14
+    components: { SurveyForm },
15
+    props: {
16
+        pid: {
17
+            type: Number,
18
+            required: true
19
+        }
20
+    },
19 21
     data() {
20 22
         return { 
21 23
             validSurvey: null,
22 24
         }
23 25
     },
24
-    computed: {
25
-        pid() {
26
-            return loginHandler.currentProfileId
27
-        }
28
-    },
29 26
     async created() {
30
-        console.log('survey for:', this.$route.query.pid)
31
-        this.validSurvey = await fetchSurveyByProfileId(this.$route.query.pid)
27
+        console.log('survey for:', this.pid)
28
+        this.validSurvey = await fetchSurveyByProfileId(this.pid)
32 29
     },
33 30
 }
34 31
 </script>

Notiek ielāde…
Atcelt
Saglabāt