mirror of
https://github.com/strapi/strapi.git
synced 2025-12-13 07:55:33 +00:00
74 lines
997 B
JavaScript
74 lines
997 B
JavaScript
/*
|
|
*
|
|
* List actions
|
|
*
|
|
*/
|
|
|
|
import pluralize from 'pluralize';
|
|
|
|
import {
|
|
SET_CURRENT_MODEL_NAME,
|
|
LOAD_RECORDS,
|
|
LOADED_RECORDS,
|
|
LOAD_COUNT,
|
|
LOADED_COUNT,
|
|
CHANGE_PAGE,
|
|
CHANGE_SORT,
|
|
CHANGE_LIMIT,
|
|
} from './constants';
|
|
|
|
export function setCurrentModelName(modelName) {
|
|
return {
|
|
type: SET_CURRENT_MODEL_NAME,
|
|
modelName,
|
|
modelNamePluralized: pluralize(modelName),
|
|
};
|
|
}
|
|
|
|
export function loadRecords() {
|
|
return {
|
|
type: LOAD_RECORDS,
|
|
};
|
|
}
|
|
|
|
export function loadedRecord(records) {
|
|
return {
|
|
type: LOADED_RECORDS,
|
|
records,
|
|
};
|
|
}
|
|
|
|
export function loadCount() {
|
|
return {
|
|
type: LOAD_COUNT,
|
|
};
|
|
}
|
|
|
|
export function loadedCount(count) {
|
|
return {
|
|
type: LOADED_COUNT,
|
|
count,
|
|
};
|
|
}
|
|
|
|
export function changePage(page) {
|
|
return {
|
|
type: CHANGE_PAGE,
|
|
page,
|
|
};
|
|
}
|
|
|
|
export function changeSort(sort) {
|
|
return {
|
|
type: CHANGE_SORT,
|
|
sort,
|
|
};
|
|
}
|
|
|
|
export function changeLimit(limit) {
|
|
return {
|
|
type: CHANGE_LIMIT,
|
|
limit,
|
|
};
|
|
}
|