MCPcopy Index your code
hub / github.com/coder/coder / updateUserNotificationPreferences

Function updateUserNotificationPreferences

site/src/api/queries/notifications.ts:24–50  ·  view source on GitHub ↗
(
	userId: string,
	queryClient: QueryClient,
)

Source from the content-addressed store, hash-verified

22};
23
24export const updateUserNotificationPreferences = (
25 userId: string,
26 queryClient: QueryClient,
27) => {
28 return {
29 mutationFn: (req) => {
30 return API.putUserNotificationPreferences(userId, req);
31 },
32 onMutate: (data) => {
33 queryClient.setQueryData(
34 userNotificationPreferencesKey(userId),
35 Object.entries(data.template_disabled_map).map(
36 ([id, disabled]) =>
37 ({
38 id,
39 disabled,
40 updated_at: new Date().toISOString(),
41 }) satisfies NotificationPreference,
42 ),
43 );
44 },
45 } satisfies UseMutationOptions<
46 NotificationPreference[],
47 unknown,
48 UpdateUserNotificationPreferences
49 >;
50};
51
52export const systemNotificationTemplatesKey = [
53 "notifications",

Callers 1

NotificationsPageFunction · 0.90

Tested by

no test coverage detected