Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Added more actions to profile dropdown" #85

Merged
merged 1 commit into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions zubhub_frontend/zubhub/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ services:
container_name: zubhub_frontend
build:
context: .
<<<<<<< HEAD
dockerfile: Dockerfile
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
=======
dockerfile: Dockerfile.prod
volumes:
- ./nginx/prod/default.conf:/etc/nginx/conf.d/default.conf
>>>>>>> e27329f26fe2cff77464c3965a2859d1d6c0b01f
restart: on-failure
ports:
- "80"
Expand Down
4 changes: 0 additions & 4 deletions zubhub_frontend/zubhub/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@ services:
- ./nginx/dev/default.conf:/etc/nginx/conf.d/default.conf
restart: on-failure
ports:
<<<<<<< HEAD
- "80:80"
=======
- "3000:3000"
>>>>>>> e27329f26fe2cff77464c3965a2859d1d6c0b01f
27 changes: 0 additions & 27 deletions zubhub_frontend/zubhub/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions zubhub_frontend/zubhub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"@testing-library/user-event": "^12.2.2",
"aws-sdk": "^2.813.0",
"classnames": "^2.2.6",
"compressorjs": "^1.0.7",
"date-fns": "^2.16.1",
"formik": "^2.2.5",
"nanoid": "^3.1.20",
Expand All @@ -28,7 +27,6 @@
"redux-thunk": "^2.3.0",
"slick-carousel": "^1.8.1",
"web-vitals": "^0.2.4",
"workerize-loader": "^1.3.0",
"yup": "^0.29.3"
},
"scripts": {
Expand Down Expand Up @@ -57,6 +55,6 @@
]
},
"devDependencies": {
"prettier": "^2.2.1"
"prettier": "2.2.1"
}
}
39 changes: 0 additions & 39 deletions zubhub_frontend/zubhub/src/assets/js/Compress.js

This file was deleted.

62 changes: 0 additions & 62 deletions zubhub_frontend/zubhub/src/assets/js/removeMetaDataWorker.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ const styles = theme => ({
},
},
},
DOBInputStyle: {
'&.MuiOutlinedInput-root fieldset legend': {
width: '75.5px !important',
},
},
secondaryLink: {
color: '#00B8C4',
'&:hover': {
Expand Down
91 changes: 69 additions & 22 deletions zubhub_frontend/zubhub/src/store/actions/authActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,27 @@ export const login = props => {
return API.login(props.values)
.then(res => {
if (!res.key) {
throw new Error(JSON.stringify(res));
res = Object.keys(res)
.map(key => res[key])
.join('\n');
throw new Error(res);
}
dispatch({
type: 'SET_AUTH_USER',
payload: { token: res.key },
});
})
.then(() => props.history.push('/profile'));
.then(() => props.history.push('/profile'))
.catch(error => {
if (error.message.startsWith('Unexpected')) {
return {
error:
'An error occured while performing this action. Please try again later',
};
} else {
return { error: error.message };
}
});
};
};

Expand Down Expand Up @@ -72,61 +85,95 @@ export const signup = props => {
return API.signup(props.values)
.then(res => {
if (!res.key) {
throw new Error(JSON.stringify(res));
res = Object.keys(res)
.map(key => res[key])
.join('\n');
throw new Error(res);
}
dispatch({
type: 'SET_AUTH_USER',
payload: { token: res.key },
});
})
.then(() => props.history.push('/profile'));
.then(() => props.history.push('/profile'))
.catch(error => {
if (error.message.startsWith('Unexpected')) {
return {
error:
'An error occured while performing this action. Please try again later',
};
} else {
return { error: error.message };
}
});
};
};

export const send_email_confirmation = (props, key) => {
return () => {
return API.send_email_confirmation(key).then(res => {
if (res.detail !== 'ok') {
throw new Error(res.detail);
} else {
return API.send_email_confirmation(key)
.then(res => {
toast.success('Congratulations!, your email has been confirmed!');
setTimeout(() => {
props.history.push('/');
}, 4000);
}
});
})
.catch(error => {
if (error.message.startsWith('Unexpected')) {
return {
error:
'An error occured while performing this action. Please try again later',
};
} else {
return { error: error.message };
}
});
};
};

export const send_password_reset_link = props => {
return () => {
return API.send_password_reset_link(props.values.email).then(res => {
if (res.detail !== 'Password reset e-mail has been sent.') {
throw new Error(JSON.stringify(res));
} else {
return API.send_password_reset_link(props.values.email)
.then(res => {
toast.success('We just sent a password reset link to your email!');
setTimeout(() => {
props.history.push('/');
}, 4000);
}
});
})
.catch(error => {
if (error.message.startsWith('Unexpected')) {
return {
error:
'An error occured while performing this action. Please try again later',
};
} else {
return { error: error.message };
}
});
};
};

export const password_reset_confirm = props => {
return () => {
return API.password_reset_confirm(props).then(res => {
if (res.detail !== 'Password has been reset with the new password.') {
throw new Error(JSON.stringify(res));
} else {
return API.password_reset_confirm(props)
.then(res => {
toast.success(
'Congratulations! your password reset was successful! you will now be redirected to login',
);
setTimeout(() => {
props.history.push('/login');
}, 4000);
}
});
})
.catch(error => {
if (error.message.startsWith('Unexpected')) {
return {
error:
'An error occured while performing this action. Please try again later',
};
} else {
return { error: error.message };
}
});
};
};

Expand Down
Loading