Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
0x43
eBookHub-frontend
Commits
853f5a20
Commit
853f5a20
authored
Apr 04, 2019
by
Mycha de Vrees
Browse files
fix pagination after provider fetch
parent
96f6e49a
Pipeline
#330
passed with stage
in 1 minute and 34 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/pages/GenresList.vue
View file @
853f5a20
...
...
@@ -30,7 +30,7 @@
:filter=
"genresFilter"
:current-page=
"currentPage"
:per-page=
"perPage"
:sort-by.sync=
"sort"
:sort-by.sync=
"sort
By
"
:sort-desc.sync=
"sortDesc"
@
filtered=
"onFiltered"
>
...
...
@@ -99,16 +99,15 @@ export default {
this
.
isBusy
=
true
await
this
.
fetchGenres
({
ctx
,
vm
:
this
})
// await this.$store.dispatch('fetchGenres', {ctx, vm: this})
this
.
isBusy
=
false
this
.
totalRows
=
this
.
$store
.
state
.
genre
.
count
return
this
.
$store
.
state
.
genre
.
all
}
},
computed
:
{
genreRows
:
{
get
()
{
return
this
.
genreItems
.
length
return
this
.
$store
.
state
.
genre
.
count
},
set
(
newVal
)
{
this
.
totalRows
=
newVal
...
...
src/store/modules/genre.js
View file @
853f5a20
...
...
@@ -32,7 +32,8 @@ const getters = {
* @returns {{all: {}, isFetching: boolean, error: string }}
*/
const
getDefaultState
=
()
=>
({
all
:
{},
all
:
[],
count
:
0
,
isFetching
:
false
,
error
:
null
})
...
...
@@ -63,7 +64,8 @@ const actions = {
const
params
=
{
contentType
:
'
application/json
'
,
...
newCtx
}
const
response
=
await
getGenre
(
params
)
const
genres
=
GenreTransformer
.
fetch
(
response
)
commit
(
GENRES_FETCH_SUCCESS
,
genres
)
const
{
count
}
=
response
.
data
.
meta
commit
(
GENRES_FETCH_SUCCESS
,
{
genres
,
count
})
}
catch
(
error
)
{
vm
.
$notify
({
message
:
error
,
...
...
@@ -86,8 +88,9 @@ const mutations = {
state
.
isFetching
=
current
state
.
error
=
error
},
[
GENRES_FETCH_SUCCESS
]
(
state
,
genres
)
{
[
GENRES_FETCH_SUCCESS
]
(
state
,
{
genres
,
count
}
)
{
state
.
all
=
genres
state
.
count
=
count
state
.
isFetching
=
false
}
}
...
...
src/transformers/CtxTransformer.js
View file @
853f5a20
...
...
@@ -10,7 +10,6 @@ class CtxTransformer extends Transformer {
* @returns {object}
*/
static
transformCtx
(
ctx
)
{
console
.
log
(
ctx
)
return
{
...
ctx
,
pageOffset
:
(
ctx
.
currentPage
-
1
)
*
10
,
...
...
src/transformers/GenreTransformer.js
View file @
853f5a20
...
...
@@ -18,6 +18,7 @@ class GenreTransformer extends Transformer {
}
genres
.
push
(
obj
)
})
return
genres
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment