Fix issue with multipart data typing in Settings

This probably doesn't totally fix the problems with uploading a new
avatar becasue the interface hasn't been fully tested due to the
problems outlined in #26, the documentation is kind of ambiguous on how
the data is handled and I honestly don't know much about multipart form
data, as I have recently discovered
This commit is contained in:
Nat 2021-07-01 18:02:41 -03:00
parent 54ec1eafee
commit f057b71686
1 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import {
Dimensions, Dimensions,
} from "react-native"; } from "react-native";
import { FontAwesome } from '@expo/vector-icons'; import { FontAwesome } from '@expo/vector-icons';
import mime from "mime";
import AsyncStorage from "@react-native-async-storage/async-storage"; import AsyncStorage from "@react-native-async-storage/async-storage";
import * as requests from "src/requests"; import * as requests from "src/requests";
@ -90,7 +91,7 @@ const SettingsJsx = (props) => {
const _handleChangeProfilePhoto = async () => { const _handleChangeProfilePhoto = async () => {
await ImagePicker.getCameraRollPermissionsAsync() await ImagePicker.getCameraRollPermissionsAsync()
const { uri, type } = await ImagePicker.launchImageLibraryAsync({ const { uri } = await ImagePicker.launchImageLibraryAsync({
allowsEditing: true, allowsEditing: true,
aspect: [1, 1], aspect: [1, 1],
}); });
@ -100,7 +101,7 @@ const SettingsJsx = (props) => {
setState({...state, setState({...state,
newAvatar: { newAvatar: {
uri, uri,
type, type: mime.getType(uri),
name, name,
}, },
}); });