Skip to content

Commit ffffeaf

Browse files
committed
use config PAGE_SIZE
1 parent 1d5f045 commit ffffeaf

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

stores/SharedModel/Category.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { types as t } from 'mobx-state-tree'
22

3-
// NOTE: the SimpleXXX version is to avoid circle import issue which cause MST error
3+
import { PAGE_SIZE } from '../../config'
44

5+
// NOTE: the SimpleXXX version is to avoid circle import issue which cause MST error
56
const SimpleCommunity = t.model('SimpleCommunity', {
67
id: t.maybe(t.string),
78
title: t.maybe(t.string),
@@ -29,7 +30,7 @@ export const Category = t.model('Category', {
2930
export const PagedCategories = t.model('PagedCategories', {
3031
entries: t.optional(t.array(Category), []),
3132
pageNumber: t.optional(t.number, 1),
32-
pageSize: t.optional(t.number, 20), // TODO: USE CONSTANTS
33+
pageSize: t.optional(t.number, PAGE_SIZE.COMMON),
3334
totalCount: t.optional(t.number, 0),
3435
totalPages: t.optional(t.number, 0),
3536
})

stores/SharedModel/Post.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import { types as t } from 'mobx-state-tree'
2+
3+
import { PAGE_SIZE } from '../../config'
4+
25
import { User } from './User'
36
import Community from './Community'
47
import Comment from './Comment'
@@ -29,7 +32,7 @@ export const Post = t.model('Post', {
2932
export const PagedPosts = t.model('PagedPosts', {
3033
entries: t.optional(t.array(Post), []),
3134
pageNumber: t.optional(t.number, 1),
32-
pageSize: t.optional(t.number, 20), // TODO: USE CONSTANTS
35+
pageSize: t.optional(t.number, PAGE_SIZE.COMMON),
3336
totalCount: t.optional(t.number, 0),
3437
totalPages: t.optional(t.number, 0),
3538
})

stores/SharedModel/Tag.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { types as t } from 'mobx-state-tree'
2-
import { TAG_COLORS, CMS_PARTS } from '../../config'
2+
import { TAG_COLORS, CMS_PARTS, PAGE_SIZE } from '../../config'
33

44
import { Community } from '../SharedModel'
55

66
export const Tag = t.model('Tag', {
77
id: t.maybe(t.string),
88
title: t.maybe(t.string),
99
color: t.optional(t.enumeration('color', TAG_COLORS), TAG_COLORS[0]),
10-
// TODO: change to Enum
11-
/* part: t.maybe(t.string), */
1210
part: t.optional(t.enumeration('part', CMS_PARTS), CMS_PARTS[0]),
1311
community: t.maybe(Community),
1412
insertedAt: t.optional(t.string, ''),
@@ -18,7 +16,7 @@ export const Tag = t.model('Tag', {
1816
export const PagedTags = t.model('PagedTags', {
1917
entries: t.optional(t.array(Tag), []),
2018
pageNumber: t.optional(t.number, 1),
21-
pageSize: t.optional(t.number, 20), // TODO: USE CONSTANTS
19+
pageSize: t.optional(t.number, PAGE_SIZE.COMMON),
2220
totalCount: t.optional(t.number, 0),
2321
totalPages: t.optional(t.number, 0),
2422
})

0 commit comments

Comments
 (0)