( authorization: AuthorizationRequest, queryClient: QueryClient, )
| 181 | }; |
| 182 | |
| 183 | export const login = ( |
| 184 | authorization: AuthorizationRequest, |
| 185 | queryClient: QueryClient, |
| 186 | ) => { |
| 187 | return { |
| 188 | mutationFn: async (credentials: { email: string; password: string }) => |
| 189 | loginFn({ ...credentials, authorization }), |
| 190 | onSuccess: async (data: Awaited<ReturnType<typeof loginFn>>) => { |
| 191 | queryClient.setQueryData(meKey, data.user); |
| 192 | queryClient.setQueryData( |
| 193 | getAuthorizationKey(authorization), |
| 194 | data.permissions, |
| 195 | ); |
| 196 | }, |
| 197 | }; |
| 198 | }; |
| 199 | |
| 200 | const loginFn = async ({ |
| 201 | email, |
no test coverage detected