1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Moving to JSON instead of FormData for oauth

This commit is contained in:
xmflsct
2023-01-09 16:44:11 +01:00
parent 1b2d9d144f
commit 1025d85ae5

View File

@ -29,24 +29,23 @@ const useAppsQuery = (
return useQuery(queryKey, queryFunctionApps, params?.options)
}
type MutationVarsApps = { domain: string }
type MutationVarsApps = { domain: string; scopes: string[] }
export const redirectUri = AuthSession.makeRedirectUri({
native: 'tooot://instance-auth',
useProxy: false
})
const mutationFunctionApps = async ({ domain }: MutationVarsApps) => {
const formData = new FormData()
formData.append('client_name', 'tooot')
formData.append('website', 'https://tooot.app')
formData.append('redirect_uris', redirectUri)
formData.append('scopes', 'read write follow push')
const mutationFunctionApps = async ({ domain, scopes }: MutationVarsApps) => {
return apiGeneral<Mastodon.Apps>({
method: 'post',
domain: domain,
url: `api/v1/apps`,
body: formData
url: 'api/v1/apps',
body: {
client_name: 'tooot',
website: 'https://tooot.app',
redirect_uris: redirectUri,
scopes: scopes.join(' ')
}
}).then(res => res.body)
}