mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Fixed #347
This commit is contained in:
@@ -64,14 +64,18 @@ type MutationVarsProfile = MutationVarsProfileBase & {
|
|||||||
const mutationFunction = async ({ type, data }: MutationVarsProfile) => {
|
const mutationFunction = async ({ type, data }: MutationVarsProfile) => {
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
if (type === 'fields_attributes') {
|
if (type === 'fields_attributes') {
|
||||||
const tempData = data as { name: string; value: string }[]
|
if (!data.length) {
|
||||||
tempData.forEach((d, index) => {
|
formData.append('fields_attributes[]', '')
|
||||||
formData.append(`fields_attributes[${index}][name]`, d.name)
|
} else {
|
||||||
formData.append(`fields_attributes[${index}][value]`, d.value)
|
const tempData = data as { name: string; value: string }[]
|
||||||
})
|
tempData.forEach((d, index) => {
|
||||||
|
formData.append(`fields_attributes[${index}][name]`, d.name)
|
||||||
|
formData.append(`fields_attributes[${index}][value]`, d.value)
|
||||||
|
})
|
||||||
|
}
|
||||||
} else if (type === 'avatar' || type === 'header') {
|
} else if (type === 'avatar' || type === 'header') {
|
||||||
formData.append(type, {
|
formData.append(type, {
|
||||||
uri: `file://${data}`,
|
uri: data,
|
||||||
name: 'image/jpeg',
|
name: 'image/jpeg',
|
||||||
type: 'image/jpeg'
|
type: 'image/jpeg'
|
||||||
} as any)
|
} as any)
|
||||||
|
Reference in New Issue
Block a user