mirror of
https://github.com/Athou/commafeed.git
synced 2026-11-03 02:44:47 +00:00
refactor
This commit is contained in:
@@ -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