mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Basic new react-navigation types
This commit is contained in:
@ -54,6 +54,13 @@ const addInstance = createAsyncThunk(
|
||||
headers: { Authorization: `Bearer ${token}` }
|
||||
})
|
||||
|
||||
const { body: filters } = await apiGeneral<Mastodon.Filter[]>({
|
||||
method: 'get',
|
||||
domain,
|
||||
url: `api/v1/filters`,
|
||||
headers: { Authorization: `Bearer ${token}` }
|
||||
})
|
||||
|
||||
return Promise.resolve({
|
||||
type,
|
||||
data: {
|
||||
@ -70,6 +77,7 @@ const addInstance = createAsyncThunk(
|
||||
avatarStatic: avatar_static,
|
||||
preferences
|
||||
},
|
||||
filters,
|
||||
notifications_filter: {
|
||||
follow: true,
|
||||
favourite: true,
|
||||
|
@ -12,7 +12,7 @@ export const updateInstancePushDecode = createAsyncThunk(
|
||||
async (
|
||||
disable: boolean,
|
||||
{ getState }
|
||||
): Promise<Instance['push']['decode']['value']> => {
|
||||
): Promise<{ disable: Instance['push']['decode']['value'] }> => {
|
||||
const state = getState() as RootState
|
||||
const instance = getInstance(state)
|
||||
if (!instance?.url || !instance.account.id || !instance.push.keys) {
|
||||
@ -89,6 +89,6 @@ export const updateInstancePushDecode = createAsyncThunk(
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.resolve(disable)
|
||||
return Promise.resolve({ disable })
|
||||
}
|
||||
)
|
||||
|
@ -274,7 +274,7 @@ const instancesSlice = createSlice({
|
||||
.addCase(updateInstancePushDecode.fulfilled, (state, action) => {
|
||||
const activeIndex = findInstanceActive(state.instances)
|
||||
state.instances[activeIndex].push.decode.loading = false
|
||||
state.instances[activeIndex].push.decode.value = action.payload
|
||||
state.instances[activeIndex].push.decode.value = action.payload.disable
|
||||
})
|
||||
.addCase(updateInstancePushDecode.rejected, state => {
|
||||
const activeIndex = findInstanceActive(state.instances)
|
||||
|
@ -13,7 +13,7 @@ export const changeAnalytics = createAsyncThunk(
|
||||
'settings/changeAnalytics',
|
||||
async (newValue: SettingsState['analytics']) => {
|
||||
await Analytics.setAnalyticsCollectionEnabled(newValue)
|
||||
return newValue
|
||||
return { newValue }
|
||||
}
|
||||
)
|
||||
|
||||
@ -75,7 +75,7 @@ const settingsSlice = createSlice({
|
||||
},
|
||||
extraReducers: builder => {
|
||||
builder.addCase(changeAnalytics.fulfilled, (state, action) => {
|
||||
state.analytics = action.payload
|
||||
state.analytics = action.payload.newValue
|
||||
})
|
||||
}
|
||||
})
|
||||
|
@ -29,7 +29,7 @@ const versionSlice = createSlice({
|
||||
reducers: {},
|
||||
extraReducers: builder => {
|
||||
builder.addCase(retriveVersionLatest.fulfilled, (state, action) => {
|
||||
if (action.payload && Constants.manifest.version) {
|
||||
if (action.payload && Constants.manifest?.version) {
|
||||
if (parseInt(action.payload) > parseInt(Constants.manifest.version)) {
|
||||
state.update = true
|
||||
}
|
||||
|
Reference in New Issue
Block a user