MCPcopy Create free account
hub / github.com/coder/coder / withAuthProvider

Function withAuthProvider

site/src/testHelpers/storybook.tsx:159–176  ·  view source on GitHub ↗
(Story: FC, { parameters }: StoryContext)

Source from the content-addressed store, hash-verified

157);
158
159export const withAuthProvider = (Story: FC, { parameters }: StoryContext) => {
160 if (!parameters.user) {
161 throw new Error("You forgot to add `parameters.user` to your story");
162 }
163 const queryClient = useQueryClient();
164 queryClient.setQueryData(meKey, parameters.user);
165 queryClient.setQueryData(hasFirstUserKey, true);
166 queryClient.setQueryData(
167 getAuthorizationKey({ checks: permissionChecks }),
168 parameters.permissions ?? {},
169 );
170
171 return (
172 <AuthProvider>
173 <Story />
174 </AuthProvider>
175 );
176};
177
178export const withToaster = (Story: FC) => (
179 <>

Callers

nothing calls this directly

Calls 1

getAuthorizationKeyFunction · 0.90

Tested by

no test coverage detected