diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/CurrentUsersReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/CurrentUsersReview.js index eb32114bb5..eca40fc60e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/CurrentUsersReview.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/CurrentUsersReview.js @@ -42,13 +42,6 @@ class CurrentUsersReview extends React.Component { }); }; - updateCallback = (response) =>{ - const {rating, content} = response; - this.setState({ - rating, - content - }); - }; render() { const {data} = this.state; @@ -67,7 +60,7 @@ class CurrentUsersReview extends React.Component { dataSource={data} renderItem={item => ( - + )} > diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.js index 66a7033bd5..8ca5820858 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.js @@ -10,16 +10,44 @@ const {Text, Paragraph} = Typography; const colorList = ['#f0932b', '#badc58', '#6ab04c', '#eb4d4b', '#0abde3', '#9b59b6', '#3498db', '#22a6b3','#e84393','#f9ca24']; class SingleReview extends React.Component { + constructor(props) { + super(props); + this.state = { + content: '', + rating: 0, + color: '#f0932b' + } + } + + componentDidMount() { + const {content, rating, username} = this.props.review; + const color = colorList[username.length%10]; + this.setState({ + content, + rating, + color + }); + } + + + updateCallback = (response) =>{ + console.log(response); + const {rating, content} = response; + this.setState({ + rating, + content + }); + }; render() { const {review, isEditable, isDeletable, uuid} = this.props; + const {content, rating, color} = this.state; const {username} = review; - const randomColor = colorList[username.length%10]; const avatarLetter = username.charAt(0).toUpperCase(); - const content = ( + const body = (
{review.createdAt}
- {review.content} + {content}
@@ -38,7 +66,7 @@ class SingleReview extends React.Component { const title = (
{review.username} - {isEditable && ()} + {isEditable && ()} {isDeletable && (delete)}
); @@ -47,12 +75,12 @@ class SingleReview extends React.Component {
+ {avatarLetter} } title={title} - description={content} + description={body} />
); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.js index ed72f51511..3a2af32e91 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.js @@ -80,6 +80,8 @@ class EditReview extends React.Component { description: 'Your review has been update successfully.', }); + + this.props.updateCallback(res.data.data); } else { this.setState({ loading: false, @@ -93,7 +95,8 @@ class EditReview extends React.Component { } }).catch((error) => { - if (error.response.status === 401) { + console.log(error); + if (error.hasOwnProperty("response") && error.response.status === 401) { window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; } else { this.setState({