Upgrade axios to v0.27, fix EditProfile uploads

This commit is contained in:
Alex Gleason 2022-04-29 16:01:46 -05:00
parent f808d93209
commit 2cbea4aa5b
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
9 changed files with 28 additions and 13 deletions

Binary file not shown.

View file

@ -169,7 +169,7 @@ const EditProfile: React.FC = () => {
}; };
const handleSubmit: React.FormEventHandler = (event) => { const handleSubmit: React.FormEventHandler = (event) => {
const credentials = dispatch(patchMe(data)); const credentials = dispatch(patchMe(data, true));
/* Bad API url, was causing errors in the promise call below blocking the success message after making edits. */ /* Bad API url, was causing errors in the promise call below blocking the success message after making edits. */
/* const notifications = dispatch(updateNotificationSettings({ /* const notifications = dispatch(updateNotificationSettings({
block_from_strangers: this.state.stranger_notifications || false, block_from_strangers: this.state.stranger_notifications || false,

View file

@ -61,7 +61,7 @@ const AvatarSelectionStep = ({ onNext }: { onNext: () => void }) => {
setSelectedFile(null); setSelectedFile(null);
if (error.response?.status === 422) { if (error.response?.status === 422) {
dispatch(snackbar.error(error.response.data.error.replace('Validation failed: ', ''))); dispatch(snackbar.error((error.response.data as any).error.replace('Validation failed: ', '')));
} else { } else {
dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.')); dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.'));
} }

View file

@ -33,7 +33,7 @@ const BioStep = ({ onNext }: { onNext: () => void }) => {
setSubmitting(false); setSubmitting(false);
if (error.response?.status === 422) { if (error.response?.status === 422) {
setErrors([error.response.data.error.replace('Validation failed: ', '')]); setErrors([(error.response.data as any).error.replace('Validation failed: ', '')]);
} else { } else {
dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.')); dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.'));
} }

View file

@ -62,7 +62,7 @@ const CoverPhotoSelectionStep = ({ onNext }: { onNext: () => void }) => {
setSelectedFile(null); setSelectedFile(null);
if (error.response?.status === 422) { if (error.response?.status === 422) {
dispatch(snackbar.error(error.response.data.error.replace('Validation failed: ', ''))); dispatch(snackbar.error((error.response.data as any).error.replace('Validation failed: ', '')));
} else { } else {
dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.')); dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.'));
} }

View file

@ -40,7 +40,7 @@ const DisplayNameStep = ({ onNext }: { onNext: () => void }) => {
setSubmitting(false); setSubmitting(false);
if (error.response?.status === 422) { if (error.response?.status === 422) {
setErrors([error.response.data.error.replace('Validation failed: ', '')]); setErrors([(error.response.data as any).error.replace('Validation failed: ', '')]);
} else { } else {
dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.')); dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.'));
} }

View file

@ -57,7 +57,7 @@ const Header = () => {
.catch((error: AxiosError) => { .catch((error: AxiosError) => {
setLoading(false); setLoading(false);
const data = error.response?.data; const data: any = error.response?.data;
if (data?.error === 'mfa_required') { if (data?.error === 'mfa_required') {
setMfaToken(data.mfa_token); setMfaToken(data.mfa_token);
} }

View file

@ -89,7 +89,7 @@
"@types/uuid": "^8.3.4", "@types/uuid": "^8.3.4",
"array-includes": "^3.0.3", "array-includes": "^3.0.3",
"autoprefixer": "^10.4.2", "autoprefixer": "^10.4.2",
"axios": "^0.21.4", "axios": "^0.27.2",
"axios-mock-adapter": "^1.18.1", "axios-mock-adapter": "^1.18.1",
"babel-loader": "^8.2.2", "babel-loader": "^8.2.2",
"babel-plugin-lodash": "^3.3.4", "babel-plugin-lodash": "^3.3.4",

View file

@ -2906,12 +2906,13 @@ axios-mock-adapter@^1.18.1:
is-blob "^2.1.0" is-blob "^2.1.0"
is-buffer "^2.0.5" is-buffer "^2.0.5"
axios@^0.21.4: axios@^0.27.2:
version "0.21.4" version "0.27.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972"
integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==
dependencies: dependencies:
follow-redirects "^1.14.0" follow-redirects "^1.14.9"
form-data "^4.0.0"
axobject-query@^2.2.0: axobject-query@^2.2.0:
version "2.2.0" version "2.2.0"
@ -5106,11 +5107,16 @@ flatted@^3.1.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.2.tgz#64bfed5cb68fe3ca78b3eb214ad97b63bedce561" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.2.tgz#64bfed5cb68fe3ca78b3eb214ad97b63bedce561"
integrity sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA== integrity sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==
follow-redirects@^1.0.0, follow-redirects@^1.14.0: follow-redirects@^1.0.0:
version "1.14.4" version "1.14.4"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379"
integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g== integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==
follow-redirects@^1.14.9:
version "1.14.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==
foreach@^2.0.5: foreach@^2.0.5:
version "2.0.5" version "2.0.5"
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
@ -5144,6 +5150,15 @@ form-data@^3.0.0:
combined-stream "^1.0.8" combined-stream "^1.0.8"
mime-types "^2.1.12" mime-types "^2.1.12"
form-data@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"
forwarded@0.2.0: forwarded@0.2.0:
version "0.2.0" version "0.2.0"
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"