Skip to content

Commit 9eaec0c

Browse files
committed
[Fix] chart share #485
1 parent dbabe81 commit 9eaec0c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/molecules/ChartShare/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,13 @@ export default class ChartShare extends React.Component<Props, State> {
174174
}
175175

176176
private renderDownloadButton() {
177-
if (this.props.download) {
177+
const { download, stateToShare } = this.props;
178+
if (download) {
178179
let url = '';
179-
if (this.props.stateToShare && this.props.stateToShare.indicator) {
180-
const indicator = this.props.stateToShare.indicator.split('.')[1].replace(/-/g, '_');
180+
if (stateToShare && stateToShare.indicator) {
181+
const indicator = stateToShare.indicator.indexOf('.') > -1
182+
? stateToShare.indicator.split('.')[1].replace(/-/g, '_')
183+
: stateToShare.indicator;
181184
url = `${getWarehouseAPILink}/single_table?indicator=${indicator}&format=csv`;
182185
}
183186

0 commit comments

Comments
 (0)