aboutsummaryrefslogtreecommitdiff
path: root/src/pages/Profile/Registration
diff options
context:
space:
mode:
authorEug-VS <eug-vs@keemail.me>2020-01-12 18:04:57 +0300
committerEug-VS <eug-vs@keemail.me>2020-01-12 18:11:45 +0300
commitfff9eae8022e1e3bb88884a47bfd4153b089f444 (patch)
treea3edf615afdc83d364d58b84065017fae7fb5e98 /src/pages/Profile/Registration
parent0de06228f4b5e482b6f73230210225b332f0a2ff (diff)
downloadchrono-cube-ui-fff9eae8022e1e3bb88884a47bfd4153b089f444.tar.gz
Add Profile history, link Profile at Timer page
Diffstat (limited to 'src/pages/Profile/Registration')
-rw-r--r--src/pages/Profile/Registration/Registration.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/pages/Profile/Registration/Registration.js b/src/pages/Profile/Registration/Registration.js
index ce8384f..45c83bc 100644
--- a/src/pages/Profile/Registration/Registration.js
+++ b/src/pages/Profile/Registration/Registration.js
@@ -26,23 +26,25 @@ const Registration = ({ setUser }) => {
};
const handleSubmit = () => {
- post('users/', { username })
- .then(response => {
- const user = response.data;
- setUser(user);
- if (isRememberMe) {
- localStorage.setItem('userId', user.id);
- }
- })
- .catch(err => {
- get('users/').then(response => {
- const user = response.data.filter(user => user.username === username)[0];
+ if (username !== '') {
+ post('users/', { username })
+ .then(response => {
+ const user = response.data;
setUser(user);
if (isRememberMe) {
localStorage.setItem('userId', user.id);
}
+ })
+ .catch(err => {
+ get('users/').then(response => {
+ const user = response.data.filter(user => user.username === username)[0];
+ setUser(user);
+ if (isRememberMe) {
+ localStorage.setItem('userId', user.id);
+ }
+ });
});
- });
+ }
};
return (