mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Proper content type header for Android
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import axios from 'axios'
|
||||
import chalk from 'chalk'
|
||||
import Constants from 'expo-constants'
|
||||
import * as Sentry from 'sentry-expo'
|
||||
|
||||
const ctx = new chalk.Instance({ level: 3 })
|
||||
|
||||
@ -14,7 +13,6 @@ export type Params = {
|
||||
}
|
||||
headers?: { [key: string]: string }
|
||||
body?: FormData | Object
|
||||
sentry?: boolean
|
||||
}
|
||||
|
||||
const apiGeneral = async <T = unknown>({
|
||||
@ -23,8 +21,7 @@ const apiGeneral = async <T = unknown>({
|
||||
url,
|
||||
params,
|
||||
headers,
|
||||
body,
|
||||
sentry = true
|
||||
body
|
||||
}: Params): Promise<{ body: T }> => {
|
||||
console.log(
|
||||
ctx.bgGreen.bold(' API general ') +
|
||||
@ -45,7 +42,10 @@ const apiGeneral = async <T = unknown>({
|
||||
url,
|
||||
params,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Type':
|
||||
body && body instanceof FormData
|
||||
? 'multipart/form-data'
|
||||
: 'application/json',
|
||||
'User-Agent': `tooot/${Constants.manifest?.version}`,
|
||||
Accept: '*/*',
|
||||
...headers
|
||||
|
@ -3,7 +3,6 @@ import axios, { AxiosRequestConfig } from 'axios'
|
||||
import chalk from 'chalk'
|
||||
import Constants from 'expo-constants'
|
||||
import li from 'li'
|
||||
import * as Sentry from 'sentry-expo'
|
||||
|
||||
const ctx = new chalk.Instance({ level: 3 })
|
||||
|
||||
@ -73,7 +72,10 @@ const apiInstance = async <T = unknown>({
|
||||
url,
|
||||
params,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Type':
|
||||
body && body instanceof FormData
|
||||
? 'multipart/form-data'
|
||||
: 'application/json',
|
||||
'User-Agent': `tooot/${Constants.manifest?.version}`,
|
||||
Accept: '*/*',
|
||||
...headers,
|
||||
|
@ -48,7 +48,10 @@ const apiTooot = async <T = unknown>({
|
||||
url: `${url}`,
|
||||
params,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Type':
|
||||
body && body instanceof FormData
|
||||
? 'multipart/form-data'
|
||||
: 'application/json',
|
||||
'User-Agent': `tooot/${Constants.manifest?.version}`,
|
||||
Accept: '*/*',
|
||||
...headers
|
||||
|
Reference in New Issue
Block a user