add sorting for every getData and navigator, Favourites need to be fixed

This commit is contained in:
Milos Holba
2020-12-08 19:14:53 +01:00
parent 2ba92ed3b6
commit 7e325c5101
8 changed files with 93 additions and 36 deletions

View File

@@ -11,9 +11,13 @@ const defaultState = {
const actions = {
getAppData: ({commit, getters}) => {
let getSort = JSON.parse(localStorage.getItem('sorting'))
let sorting = {sort : getSort ? getSort.sort : 'DESC' , field:getSort ? getSort.field : 'created_at'}
let sortingUrl = '?sort=' + sorting.field + '&direction=' + sorting.sort
return new Promise((resolve, reject) => {
axios
.get(getters.api + '/user')
.get(getters.api + '/user' + sortingUrl)
.then((response) => {
resolve(response)