Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
ViewActions: destructure function parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Dec 4, 2017
1 parent df5b142 commit f7a073c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 20 deletions.
34 changes: 21 additions & 13 deletions src/actions/ViewActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ export function getViewRowsByIds(windowId, viewId, docIds) {
);
}

export function browseViewRequest(
viewId, page, pageLength, orderBy, windowType
){
export function browseViewRequest({
windowId,
viewId,
page,
pageLength,
orderBy
}){
return axios.get(
config.API_URL +
'/documentView/' +
windowType + '/' +
windowId + '/' +
viewId +
'?firstRow=' + pageLength * (page - 1) +
'&pageLength=' + pageLength +
Expand All @@ -45,10 +49,12 @@ export function deleteView(
);
}

export function createViewRequest(
windowType, viewType, pageLength, filters, refDocType = null,
refDocId = null, refTabId = null, refRowIds = null
){
export function createViewRequest({
windowId, viewType,
pageLength,
filters,
refDocType = null, refDocId = null, refTabId = null, refRowIds = null
}){
let referencing = null;

if (refDocType && refDocId) {
Expand All @@ -63,17 +69,19 @@ export function createViewRequest(
}
}

return axios.post(config.API_URL + '/documentView/' + windowType, {
'documentType': windowType,
return axios.post(config.API_URL + '/documentView/' + windowId, {
'documentType': windowId,
'viewType': viewType,
'referencing': referencing,
'filters': filters
});
}

export function filterViewRequest(windowType, viewId, filters){
return axios.post(config.API_URL + '/documentView/' + windowType +
'/'+viewId+'/filter', {
export function filterViewRequest(windowId, viewId, filters){
return axios.post(config.API_URL +
'/documentView/' + windowId +
'/' + viewId +
'/filter', {
'filters': filters
});
}
Expand Down
24 changes: 17 additions & 7 deletions src/components/app/DocumentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,16 @@ class DocumentList extends Component {

const {page, sort, filters} = this.state;

createViewRequest(
windowType, type, this.pageLength, filters, refType, refId,
refTabId, refRowIds,
).then(response => {
createViewRequest({
windowId : windowType,
viewType : type,
pageLength : this.pageLength,
filters : filters,
refDocType : refType,
refDocId : refId,
refTabId : refTabId,
refRowIds : refRowIds,
}).then(response => {
this.mounted && this.setState({
data: response.data,
viewId: response.data.viewId
Expand Down Expand Up @@ -426,9 +432,13 @@ class DocumentList extends Component {
sortingQuery && updateUri('sort', sortingQuery);
}

return browseViewRequest(
id, page, this.pageLength, sortingQuery, windowType
).then( (response) => {
return browseViewRequest({
windowId : windowType,
viewId : id,
page : page,
pageLength : this.pageLength,
orderBy : sortingQuery
}).then( (response) => {
const selection = getSelection({
state: store.getState(),
windowType,
Expand Down

0 comments on commit f7a073c

Please sign in to comment.