Browse Source

:recycle: moved mixins to utils

tags/0.0.1
J 4 years ago
parent
commit
d01d09ae96

+ 3
- 4
frontend/src/components/Messages.vue View File

15
 </template>
15
 </template>
16
 
16
 
17
 <script>
17
 <script>
18
+import { mixins } from '../utils'
19
+
18
 export default {
20
 export default {
19
     name: 'ProfileMessages',
21
     name: 'ProfileMessages',
22
+    mixins: [ mixins.pidMixin ],
20
     props: {
23
     props: {
21
         matches: {
24
         matches: {
22
             type: [Object, Array],
25
             type: [Object, Array],
23
             default: () => []
26
             default: () => []
24
         },
27
         },
25
-        pid: {
26
-            required: true,
27
-            type: Number
28
-        }
29
     },
28
     },
30
 }
29
 }
31
 </script>
30
 </script>

+ 10
- 1
frontend/src/utils/index.js View File

3
 import { Connector } from './db'
3
 import { Connector } from './db'
4
 import { SurveyFactory } from './survey'
4
 import { SurveyFactory } from './survey'
5
 import { possible } from './lang'
5
 import { possible } from './lang'
6
+import { pidMixin, cardMixin } from './mixins'
6
 
7
 
7
 const api = new Connector('kittens')
8
 const api = new Connector('kittens')
8
 
9
 
19
 
20
 
20
 const surveyFactory = new SurveyFactory(possible['usa'])
21
 const surveyFactory = new SurveyFactory(possible['usa'])
21
 
22
 
22
-export { api, validatorMapping, surveyFactory, makeKebob }
23
+const mixins = { pidMixin, cardMixin }
24
+
25
+export { 
26
+    api,
27
+    validatorMapping,
28
+    surveyFactory,
29
+    makeKebob,
30
+    mixins
31
+}

frontend/src/views/mixins.js → frontend/src/utils/mixins.js View File

5
             required: true,
5
             required: true,
6
             validator: prop => typeof prop === 'number' || prop === null
6
             validator: prop => typeof prop === 'number' || prop === null
7
         },
7
         },
8
-    },
8
+    }
9
+}
10
+
11
+const cardMixin = {
9
     data: () => ({
12
     data: () => ({
10
         cards: [],
13
         cards: [],
11
         loading: true,
14
         loading: true,
24
     }
27
     }
25
 }
28
 }
26
 
29
 
27
-export { pidMixin }
30
+export { pidMixin, cardMixin }

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

16
 
16
 
17
 import { Card } from '../entities'
17
 import { Card } from '../entities'
18
 import { fetchQueueByProfileId } from '../services'
18
 import { fetchQueueByProfileId } from '../services'
19
-import { pidMixin } from './mixins'
19
+import { mixins } from '../utils'
20
 
20
 
21
 /** Callback used to format incoming into card */
21
 /** Callback used to format incoming into card */
22
 const convertToCard = profile => {
22
 const convertToCard = profile => {
36
 export default {
36
 export default {
37
     name: 'HomeView',
37
     name: 'HomeView',
38
     components: { ProfileCardList },
38
     components: { ProfileCardList },
39
-    mixins: [ pidMixin ],
39
+    mixins: [ mixins.pidMixin, mixins.cardMixin ],
40
     methods: {
40
     methods: {
41
         /** Gets called from pidMixins */
41
         /** Gets called from pidMixins */
42
         async getCards() {
42
         async getCards() {

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

16
 
16
 
17
 import { Card } from '../entities'
17
 import { Card } from '../entities'
18
 import { fetchMembershipsByProfileId } from '../services'
18
 import { fetchMembershipsByProfileId } from '../services'
19
-import { pidMixin } from './mixins'
19
+import { mixins } from '../utils'
20
 
20
 
21
 /** Callback used to format incoming into card */
21
 /** Callback used to format incoming into card */
22
 const convertToCard = grouping => {
22
 const convertToCard = grouping => {
36
 export default {
36
 export default {
37
     name: 'MatchView',
37
     name: 'MatchView',
38
     components: { ProfileCardList },
38
     components: { ProfileCardList },
39
-    mixins: [ pidMixin ],
39
+    mixins: [ mixins.pidMixin, mixins.cardMixin ],
40
     methods: {
40
     methods: {
41
         /** Gets called from pidMixins */
41
         /** Gets called from pidMixins */
42
         async getCards() {
42
         async getCards() {

Loading…
Cancel
Save