remove www directory, as it is a build artefact

replace custom made notification component with notistack
This commit is contained in:
rjwats
2019-08-04 18:42:58 +01:00
parent 77771aa807
commit a86b565c5a
20 changed files with 872 additions and 1093 deletions

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { withNotifier } from '../components/SnackbarNotification';
import { withSnackbar } from 'notistack';
import { redirectingAuthorizedFetch } from '../authentication/Authentication';
/*
* It is unlikely this application will grow complex enough to require redux.
@@ -10,7 +10,7 @@ import { redirectingAuthorizedFetch } from '../authentication/Authentication';
*/
export const restComponent = (endpointUrl, FormComponent) => {
return withNotifier(
return withSnackbar(
class extends React.Component {
constructor(props) {
@@ -51,7 +51,9 @@ export const restComponent = (endpointUrl, FormComponent) => {
})
.then(json => { this.setState({ data: json, fetched: true }) })
.catch(error => {
this.props.raiseNotification("Problem fetching: " + error.message);
this.props.enqueueSnackbar("Problem fetching: " + error.message, {
variant: 'error',
});
this.setState({ data: null, fetched: true, errorMessage: error.message });
});
}
@@ -72,10 +74,14 @@ export const restComponent = (endpointUrl, FormComponent) => {
throw Error("Invalid status code: " + response.status);
})
.then(json => {
this.props.raiseNotification("Changes successfully applied.");
this.props.enqueueSnackbar("Changes successfully applied.", {
variant: 'success',
});
this.setState({ data: json, fetched: true });
}).catch(error => {
this.props.raiseNotification("Problem saving: " + error.message);
this.props.enqueueSnackbar("Problem saving: " + error.message, {
variant: 'error',
});
this.setState({ data: null, fetched: true, errorMessage: error.message });
});
}