Commits (3)
{
"lerna": "2.0.0",
"version": "1.32.2",
"version": "1.33.0",
"npmClient": "yarn",
"useWorkspaces": true
}
......@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="1.33.0"></a>
# [1.33.0](https://gitlab.com/4geit/react-packages/compare/v1.32.2...v1.33.0) (2017-09-19)
### Features
* **Store - Add API endpoint:** Added fetchData, addItem and deleteItem methods ([7e0325b](https://gitlab.com/4geit/react-packages/commit/7e0325b))
<a name="1.32.2"></a>
## [1.32.2](https://gitlab.com/4geit/react-packages/compare/v1.32.1...v1.32.2) (2017-09-18)
......
{
"name": "@4geit/rct-chatbox-grid-component",
"version": "1.32.2",
"version": "1.33.0",
"description": "chatbox grid component",
"main": "dist/index.js",
"module": "dist/index.js",
......
......@@ -31,8 +31,8 @@ const styles = theme => ({
@inject('chatboxGridStore')
class RctChatboxGridComponent extends Component {
async componentWillMount() {
const { operationId } = this.props
await this.props.chatboxGridStore.fetchData(operationId)
const { listOperationId } = this.props
await this.props.chatboxGridStore.fetchData({ listOperationId })
}
render() {
......@@ -76,10 +76,15 @@ class RctChatboxGridComponent extends Component {
RctChatboxGridComponent.propTypes = {
classes: PropTypes.object.isRequired,
listOperationId: PropTypes.string.isRequired,
addOperationId: PropTypes.string.isRequired,
deleteOperationId: PropTypes.string.isRequired,
}
RctChatboxGridComponent.defaultProps = {
// TBD
listOperationId: 'userChatboxList',
addOperationId: 'addUserChatbox',
deleteOperationId: 'deleteUserChatbox',
}
export default compose(withStyles(styles), withWidth())(RctChatboxGridComponent)
......@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="1.33.0"></a>
# [1.33.0](https://gitlab.com/4geit/react-packages/compare/v1.32.2...v1.33.0) (2017-09-19)
### Features
* **Store - Add API endpoint:** Added fetchData, addItem and deleteItem methods ([7e0325b](https://gitlab.com/4geit/react-packages/commit/7e0325b))
<a name="1.32.2"></a>
## [1.32.2](https://gitlab.com/4geit/react-packages/compare/v1.32.1...v1.32.2) (2017-09-18)
......
{
"name": "@4geit/rct-chatbox-grid-store",
"version": "1.32.2",
"version": "1.33.0",
"description": "store for the chatbox-grid component",
"main": "dist/index.js",
"module": "dist/index.js",
......
......@@ -10,10 +10,10 @@ class RctChatboxGridStore {
@action setData(value) {
this.data = value
}
@action async fetchData(operationId, enabledColumns) {
@action async fetchData({ listOperationId, enabledColumns }) {
this.inProgress = true
try {
const { body } = await swaggerClientStore.client.apis.Account[operationId]()
const { body } = await swaggerClientStore.client.apis.Account[listOperationId]()
if (body.length) {
runInAction(() => {
this.setData( body )
......@@ -27,6 +27,35 @@ class RctChatboxGridStore {
})
}
}
@action async addItem({ addOperationId, listOperationId }) {
this.inProgress = true
try {
const { body } = await swaggerClientStore.client.apis.Account[addOperationId]()
runInAction(() => {
this.fetchData({ listOperationId })
})
} catch (err) {
console.error(err)
runInAction(() => {
notificationStore.newMessage(err.message)
})
}
}
@action async deleteItem ({ deleteOperationId, listOperationId }) {
this.inProgress = true
try {
const {body } = await
swaggerClientStore.client.apis.Account[deleteOperationId] ()
runInAction(() => {
this.fetchData({ listOperationId })
})
} catch (err) {
console.error(err)
runInAction(() => {
notificationStore.newMessage(err.message)
})
}
}
}
export default new RctChatboxGridStore()