add preview&Sorting menu for mobile version, refacoring sorting URI

This commit is contained in:
Milos Holba
2020-12-09 18:24:05 +01:00
parent 7e325c5101
commit c3d162b991
11 changed files with 560 additions and 60 deletions

View File

@@ -8,6 +8,10 @@ const defaultState = {
authorized: undefined,
homeDirectory: undefined,
requestedPlan: undefined,
sorting: {
sort: localStorage.getItem('sorting') ? JSON.parse(localStorage.getItem('sorting')).sort : 'DESC',
field: localStorage.getItem('sorting') ? JSON.parse(localStorage.getItem('sorting')).field : 'created_at',
},
roles: [
{
label: i18n.t('roles.admin'),
@@ -861,6 +865,10 @@ const actions = {
},
}
const mutations = {
UPDATE_SORTING(state) {
state.sorting.field = JSON.parse(localStorage.getItem('sorting')).field
state.sorting.sort = JSON.parse(localStorage.getItem('sorting')).sort
},
INIT(state, data) {
state.config = data.config
state.authorized = data.authCookie
@@ -902,6 +910,9 @@ const getters = {
config: state => state.config,
index: state => state.index,
roles: state => state.roles,
sorting: (state) => {
return {sorting: state.sorting , URI: '?sort=' + state.sorting.field + '&direction=' + state.sorting.sort}
},
}
export default {