Skip to content

Commit 1db63f0

Browse files
Export property names from defined Vuex modules.
1 parent d43d914 commit 1db63f0

File tree

24 files changed

+121
-97
lines changed

24 files changed

+121
-97
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
22
import { namespace } from 'vuex-class';
3+
import { ModuleName, StateType } from '@/plugins/store/modules/activity';
34
import FeedCard from '@/components/activity/feed_card/FeedCard.vue';
45
import { IArticle } from '@/data/articles';
56

@@ -9,20 +10,20 @@ export default class Feed extends Vue {
910
private layout: number[] = [2, 2, 2, 2, 2, 2, 2];
1011
private page: number = 1;
1112

12-
@namespace('activity').State('photos') photos!: IArticle[];
13+
@namespace(ModuleName).State(StateType.PHOTOS) photos!: IArticle[];
1314

14-
get pages() {
15+
get pages () {
1516
return Math.ceil(this.photos.length / 11);
1617
}
1718

18-
get paginatedPhotos() {
19+
get paginatedPhotos () {
1920
const start = (this.page - 1) * 4;
2021
const stop = this.page * 4;
2122

2223
return this.photos.slice(start, stop);
2324
}
2425

25-
@Watch('page') onPageChanged(value: number, oldValue: number) {
26+
@Watch('page') onPageChanged (value: number, oldValue: number) {
2627
window.scrollTo(0, 0);
2728
}
2829
}

src/components/home/feed/Feed.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
22
import { namespace, State } from 'vuex-class';
3+
import { ModuleName, StateType } from '@/plugins/store/modules/home';
34
import FeedCard from '@/components/home/feed_card/FeedCard.vue';
45
import { IArticle } from '@/data/articles';
56

@@ -9,20 +10,20 @@ export default class Feed extends Vue {
910
private layout: number[] = [2, 2, 1, 2, 2, 3, 3, 3, 3, 3, 3];
1011
private page: number = 1;
1112

12-
@namespace('home').State('articles') articles!: IArticle[];
13+
@namespace(ModuleName).State(StateType.TOPICS) topics!: IArticle[];
1314

14-
get pages() {
15-
return Math.ceil(this.articles.length / 11);
15+
get pages () {
16+
return Math.ceil(this.topics.length / 11);
1617
}
1718

18-
get paginatedArticles() {
19+
get paginatedTopics () {
1920
const start = (this.page - 1) * 11;
2021
const stop = this.page * 11;
2122

22-
return this.articles.slice(start, stop);
23+
return this.topics.slice(start, stop);
2324
}
2425

25-
@Watch('page') onPageChanged(value: number, oldValue: number) {
26+
@Watch('page') onPageChanged (value: number, oldValue: number) {
2627
window.scrollTo(0, 0);
2728
}
2829
}

src/components/home/feed/Feed.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
<slot />
66
</v-col>
77

8-
<feed-card v-for="(article, i) in paginatedArticles"
9-
:key="article.title"
8+
<feed-card v-for="(topic, i) in paginatedTopics"
9+
:key="topic.title"
1010
:size="layout[i]"
11-
:value="article" />
11+
:value="topic" />
1212
</v-row>
1313

1414
<v-row align="center">
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
22
import { namespace, State } from 'vuex-class';
3+
import { ModuleName, StateType } from '@/plugins/store/modules/home';
34
import { IArticle } from '@/data/articles';
45

56
@Component({})
67
export default class NewestPosts extends Vue {
7-
@namespace('home').State('articles') articles!: IArticle[];
8+
@namespace(ModuleName).State(StateType.TOPICS) topics!: IArticle[];
89
};

src/components/home/newest_posts/NewestPosts.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
22
<v-container pa-0>
33
<base-subheading>Newest Blog Posts</base-subheading>
4-
<v-row v-for="(article, i) in articles.slice(11, 14)"
4+
<v-row v-for="(topic, i) in topics.slice(11, 14)"
55
:key="i"
66
align="center"
77
class="mb-2">
88
<v-col sm="12"
99
class="d-flex">
10-
<v-img :src="require(`@/assets/articles/${article.hero}`)"
10+
<v-img :src="require(`@/assets/articles/${topic.hero}`)"
1111
class="mr-3"
1212
height="36"
1313
max-width="36" />

src/components/home/tags/Tags.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
2+
import { ModuleName, GetterType } from '@/plugins/store/modules/home';
23
import { namespace, State, Getter } from 'vuex-class';
34

45
@Component({})
56
export default class Tags extends Vue {
6-
@namespace('home').Getter('categories') categories!: any;
7+
@namespace(ModuleName).Getter(GetterType.CATEGORIES) categories!: any;
78
};

src/pages/generic/cta/Cta.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
22
import { namespace } from 'vuex-class';
3-
import { ActionType } from '@/plugins/store/modules/app';
3+
import { ModuleName, ActionType } from '@/plugins/store/modules/app';
44

55
@Component({})
66
export default class Cta extends Vue {
7-
@namespace('app').Action(ActionType.FETCH_IMAGES) fetchImages!: Function;
7+
@namespace(ModuleName).Action(ActionType.FETCH_IMAGES) fetchImages!: Function;
88

99
private hello () {
1010
this.fetchImages();

src/pages/generic/drawer/Drawer.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
2-
import { namespace, State, Getter, Mutation } from 'vuex-class';
2+
import { namespace } from 'vuex-class';
3+
import { ModuleName, GetterType, StateType, MutationType } from '@/plugins/store/modules/home';
34

45
@Component({ name: 'CoreDrawer' })
56
export default class Drawer extends Vue {
6-
@namespace('home').Getter('links') links: any;
7-
@namespace('home').State('drawer') drawer: any;
8-
@namespace('home').Mutation('setDrawer') setDrawer: any;
7+
@namespace(ModuleName).Getter(GetterType.LINKS) links: any;
8+
@namespace(ModuleName).State(StateType.DRAWER) drawer: any;
9+
@namespace(ModuleName).Mutation(MutationType.SET_DRAWER) setDrawer: any;
910

10-
private onClickListItem(e: any, item: any) {
11+
private onClickListItem (e: any, item: any) {
1112
e.stopPropagation();
1213

1314
if (item.to === '/') {

src/pages/generic/toolbar/Toolbar.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
22
import { namespace, State, Getter, Mutation } from 'vuex-class';
3+
import { ModuleName, GetterType, StateType, MutationType } from '@/plugins/store/modules/home';
34

45
@Component({})
56
export default class Toolbar extends Vue {
6-
@namespace('home').Getter('links') links!: any;
7-
@namespace('home').Mutation('toggleDrawer') toggleDrawer!: any;
7+
@namespace(ModuleName).Getter(GetterType.LINKS) links!: any;
8+
@namespace(ModuleName).Mutation(MutationType.TOGGLE_DRAWER) toggleDrawer!: any;
89

9-
private onClickButton(e: Event, item: any) {
10+
private onClickButton (e: Event, item: any) {
1011
e.stopPropagation();
1112
if (item.to || !item.href) return;
1213

src/pages/home/Home.vue

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
22
<div id="home">
3-
<articles>
3+
<topics>
44
<banner />
5-
</articles>
5+
</topics>
66

77
<about />
88

@@ -13,21 +13,21 @@
1313
</template>
1414

1515
<script lang="ts">
16-
import { Component, Vue } from 'vue-property-decorator';
17-
import About from './about/About.vue';
18-
import Articles from './articles/Articles.vue';
19-
import Banner from './banner/Banner.vue';
20-
import Social from './social/Social.vue';
21-
import Subscribe from './subscribe/Subscribe.vue';
16+
import { Component, Vue } from 'vue-property-decorator';
17+
import About from './about/About.vue';
18+
import Topics from './topics/Topics.vue';
19+
import Banner from './banner/Banner.vue';
20+
import Social from './social/Social.vue';
21+
import Subscribe from './subscribe/Subscribe.vue';
2222
23-
@Component({
24-
components: {
25-
About,
26-
Articles,
27-
Banner,
28-
Social,
29-
Subscribe
30-
}
31-
})
32-
export default class extends Vue {};
23+
@Component({
24+
components: {
25+
About,
26+
Topics,
27+
Banner,
28+
Social,
29+
Subscribe
30+
}
31+
})
32+
export default class extends Vue { };
3333
</script>

0 commit comments

Comments
 (0)