diff --git a/internal/goscrobble/server.go b/internal/goscrobble/server.go
index 4ed24332..d66c146a 100644
--- a/internal/goscrobble/server.go
+++ b/internal/goscrobble/server.go
@@ -145,7 +145,7 @@ func limitMiddleware(next http.HandlerFunc, limiter *IPRateLimiter) http.Handler
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
limiter := limiter.GetLimiter(r.RemoteAddr)
if !limiter.Allow() {
- msg := generateJsonError("Too many requests")
+ msg := generateJsonMessage("Too many requests")
w.WriteHeader(http.StatusTooManyRequests)
w.Write(msg)
return
diff --git a/web/src/App.css b/web/src/App.css
index c7c91f5b..ca441d26 100644
--- a/web/src/App.css
+++ b/web/src/App.css
@@ -13,6 +13,11 @@
}
}
+.toastNotifs {
+ margin-top: 100px;
+ z-index: 99999!important;
+}
+
.App-header {
background-color: #282c34;
min-height: 100vh;
diff --git a/web/src/App.js b/web/src/App.js
index b61f1b54..e5739e8d 100644
--- a/web/src/App.js
+++ b/web/src/App.js
@@ -29,18 +29,16 @@ const App = () => {
let exact = true
return (
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
);
}
diff --git a/web/src/Components/Pages/Login.js b/web/src/Components/Pages/Login.js
index 8d12db4d..04faac1e 100644
--- a/web/src/Components/Pages/Login.js
+++ b/web/src/Components/Pages/Login.js
@@ -5,23 +5,6 @@ import { Button } from 'reactstrap';
import { useToasts } from 'react-toast-notifications';
-// const FormWithToasts = () => {
-// const { addToast } = useToasts();
-
-// const onSubmit = async value => {
-// // const { error } = await dataPersistenceLayer(value);
-
-// if (error) {
-// addToast(error.message, { appearance: 'error' });
-// } else {
-// addToast('Saved Successfully', { appearance: 'success' });
-// }
-// };
-
-// return
;
-// };
-// const { addToast } = useToasts();
-
function withToast(Component) {
return function WrappedComponent(props) {
const toastFuncs = useToasts()
@@ -52,6 +35,7 @@ class Login extends React.Component {
const requestOptions = {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
+ timeout: 5000,
body: JSON.stringify({
username: this.state.username,
password: this.state.password,
@@ -67,7 +51,11 @@ class Login extends React.Component {
this.props.addToast(data.token, { appearance: 'success' });
}
this.setState({loading: false});
- }).bind(this))
+ }).bind(this))
+ .catch(() => {
+ this.props.addToast('Error submitting form. Please try again', { appearance: 'error' });
+ this.setState({loading: false});
+ });
}
render() {
diff --git a/web/src/Components/Pages/Register.js b/web/src/Components/Pages/Register.js
index 7c9fd0f8..e1926e4e 100644
--- a/web/src/Components/Pages/Register.js
+++ b/web/src/Components/Pages/Register.js
@@ -47,10 +47,10 @@ class Register extends React.Component {
return
}
- if (this.state.password.len < 8) {
- this.props.addToast('Passwords do not match', { appearance: 'error' });
- return
- }
+ // if (this.state.password.len < 8) {
+ // this.props.addToast('Password must be at least 8 characters', { appearance: 'error' });
+ // return
+ // }
this.setState({loading: true});
const requestOptions = {
@@ -67,6 +67,7 @@ class Register extends React.Component {
fetch(apiUrl, requestOptions)
.then((response) => response.json())
.then((function(data) {
+ console.log(data);
if (data.error) {
this.props.addToast(data.error, { appearance: 'error' });
} else {