From 20b7be3fb70c2f5ae0c422e11952797cfc90b816 Mon Sep 17 00:00:00 2001 From: Allen Roth Date: Tue, 31 Jul 2018 10:40:25 -0400 Subject: [PATCH] toast for broken socrata dataset --- client/components/ShowSearchResults.jsx | 2 +- client/store/dataset.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/client/components/ShowSearchResults.jsx b/client/components/ShowSearchResults.jsx index 29e9635..478fb05 100644 --- a/client/components/ShowSearchResults.jsx +++ b/client/components/ShowSearchResults.jsx @@ -18,7 +18,7 @@ export default class ShowResults extends Component { result.resource.columns_name.forEach((columnName, i) => { columObj[columnName] = result.resource.columns_datatype[i]; }) - store.dispatch(getAsyncData(domain, id, columObj, datasetName)); + store.dispatch(getAsyncData(domain, id, columObj, datasetName)) } render() { diff --git a/client/store/dataset.js b/client/store/dataset.js index a37558e..32db921 100644 --- a/client/store/dataset.js +++ b/client/store/dataset.js @@ -5,6 +5,7 @@ import { datasetColumnFormatter, uploadedDataFormatter } from './utils/datasetOrganizingFuncs' +import { toast } from 'react-toastify' /** * ACTION TYPES @@ -44,7 +45,15 @@ export const getAsyncData = (domain, id, columnObj, datasetName) => dispatch => dispatch(setData(processedData)) history.push('/graph-dataset') }) - .catch(console.error) + .catch(err => { + toast('Dataset not available, please select a different dataset', { + autoClose: 3000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true + }) + console.error(err); + }) } export const fetchAndSetDataFromS3 = awsId => dispatch => {