diff --git a/mobile/android/gradle.properties b/mobile/android/gradle.properties index 1bbc8cc..e05cd3e 100644 --- a/mobile/android/gradle.properties +++ b/mobile/android/gradle.properties @@ -25,4 +25,4 @@ android.useAndroidX=true android.enableJetifier=true # Version of flipper SDK to use with React Native -FLIPPER_VERSION=0.33.1 +FLIPPER_VERSION=0.47.0 diff --git a/mobile/src/pages/Profile/index.tsx b/mobile/src/pages/Profile/index.tsx index f0e4319..020173a 100644 --- a/mobile/src/pages/Profile/index.tsx +++ b/mobile/src/pages/Profile/index.tsx @@ -158,19 +158,26 @@ const SignUp: React.FC = () => { return; } + const imageType = response.fileName?.split('.')[1]; + const data = new FormData(); data.append('avatar', { - type: 'multipart/form-data', - name: `${user.id}-${response.fileName}`, uri: response.uri, + name: `${user.id}-${response.fileName}`, + type: `image/${imageType}`, }); try { - const apiResponse = await api.patch('/users/avatar', data); + const apiResponse = await api.patch('/users/avatar', data, { + headers: { + 'Access-Control-Allow-Methods': 'PATCH', + }, + }); updateUser(apiResponse.data); } catch (err) { + console.log(err); Alert.alert('Ocorreu um erro', 'Tente novamente'); } },