tooot/src/utils/slices/instances/updateAccountPreferences.ts

21 lines
541 B
TypeScript
Raw Normal View History

2021-02-20 19:12:44 +01:00
import apiInstance from '@api/instance'
import { createAsyncThunk } from '@reduxjs/toolkit'
export const updateAccountPreferences = createAsyncThunk(
'instances/updateAccountPreferences',
async (): Promise<Mastodon.Preferences> => {
return apiInstance<Mastodon.Preferences>({
method: 'get',
url: `preferences`
2022-12-20 00:45:53 +01:00
})
.then(res => res.body)
.catch(error => {
if (error?.status === 404) {
return Promise.resolve({})
} else {
return Promise.reject()
}
})
2021-02-20 19:12:44 +01:00
}
)