MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / saveHandler

Function saveHandler

web/dashboard/src/components/EditUserModal.tsx:76–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74 }, [user]);
75
76 const saveHandler = async () => {
77 const diff = getObjectDiff(
78 user as unknown as Record<string, unknown>,
79 userData as unknown as Record<string, unknown>,
80 );
81 const updatedUserData = diff.reduce(
82 (acc: Record<string, unknown>, property: string) => ({
83 ...acc,
84 [property]: userData[property as keyof UserData],
85 }),
86 {},
87 );
88 const res = await client
89 .mutation(UpdateUser, {
90 params: { ...updatedUserData, id: userData.id },
91 })
92 .toPromise();
93 if (res.error) {
94 toast.error(getGraphQLErrorMessage(res.error, 'User data update failed'));
95 } else if (res.data?._update_user?.id) {
96 toast.success('User data update successful');
97 }
98 setOpen(false);
99 updateUserList();
100 };
101
102 const setUserDataTyped = (
103 vars: Record<string, string | boolean | string[]>,

Callers

nothing calls this directly

Calls 3

getObjectDiffFunction · 0.90
getGraphQLErrorMessageFunction · 0.90
updateUserListFunction · 0.85

Tested by

no test coverage detected