We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dbabe81 commit 9eaec0cCopy full SHA for 9eaec0c
src/components/molecules/ChartShare/index.tsx
@@ -174,10 +174,13 @@ export default class ChartShare extends React.Component<Props, State> {
174
}
175
176
private renderDownloadButton() {
177
- if (this.props.download) {
+ const { download, stateToShare } = this.props;
178
+ if (download) {
179
let url = '';
- if (this.props.stateToShare && this.props.stateToShare.indicator) {
180
- const indicator = this.props.stateToShare.indicator.split('.')[1].replace(/-/g, '_');
+ if (stateToShare && stateToShare.indicator) {
181
+ const indicator = stateToShare.indicator.indexOf('.') > -1
182
+ ? stateToShare.indicator.split('.')[1].replace(/-/g, '_')
183
+ : stateToShare.indicator;
184
url = `${getWarehouseAPILink}/single_table?indicator=${indicator}&format=csv`;
185
186
0 commit comments