mirror of
https://github.com/Athou/commafeed.git
synced 2026-09-24 13:05:38 +00:00
refactor
This commit is contained in:
@@ -151,10 +151,7 @@ export const userSlice = createSlice({
|
||||
})
|
||||
builder.addCase(changeNotificationSettings.pending, (state, action) => {
|
||||
if (!state.settings) return
|
||||
state.settings.notificationSettings = {
|
||||
...state.settings.notificationSettings,
|
||||
...action.meta.arg,
|
||||
}
|
||||
state.settings.pushNotificationSettings = action.meta.arg
|
||||
})
|
||||
|
||||
builder.addMatcher(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createAppAsyncThunk } from "@/app/async-thunk"
|
||||
import { client } from "@/app/client"
|
||||
import { reloadEntries } from "@/app/entries/thunks"
|
||||
import type { IconDisplayMode, NotificationSettings, ReadingMode, ReadingOrder, ScrollMode, SharingSettings } from "@/app/types"
|
||||
import type { IconDisplayMode, PushNotificationSettings, ReadingMode, ReadingOrder, ScrollMode, SharingSettings } from "@/app/types"
|
||||
|
||||
export const reloadSettings = createAppAsyncThunk("settings/reload", async () => await client.user.getSettings().then(r => r.data))
|
||||
|
||||
@@ -160,15 +160,12 @@ export const changeSharingSetting = createAppAsyncThunk(
|
||||
|
||||
export const changeNotificationSettings = createAppAsyncThunk(
|
||||
"settings/notificationSettings",
|
||||
(notificationUpdate: Partial<NotificationSettings>, thunkApi) => {
|
||||
(pushNotificationSettings: PushNotificationSettings, thunkApi) => {
|
||||
const { settings } = thunkApi.getState().user
|
||||
if (!settings) return
|
||||
client.user.saveSettings({
|
||||
...settings,
|
||||
notificationSettings: {
|
||||
...settings.notificationSettings,
|
||||
...notificationUpdate,
|
||||
},
|
||||
pushNotificationSettings,
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user