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

Function useAuthenticated

site/src/hooks/useAuthenticated.ts:17–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15>;
16
17export const useAuthenticated = (): AuthenticatedAuthContextValue => {
18 const auth = useAuthContext();
19
20 if (!auth.user) {
21 throw new Error("User is not authenticated.");
22 }
23
24 if (!auth.permissions) {
25 throw new Error("Permissions are not available.");
26 }
27
28 return auth as AuthenticatedAuthContextValue;
29};

Callers 15

WildcardHostnameWarningFunction · 0.90
CreateTaskFormFunction · 0.90
TasksSidebarFunction · 0.90
UserComboboxFunction · 0.90
DeploymentSettingsLayoutFunction · 0.90
OrganizationSidebarFunction · 0.90
DeploymentSidebarFunction · 0.90
AISettingsSidebarFunction · 0.90
DashboardLayoutFunction · 0.90
DashboardProviderFunction · 0.90
DeploymentBannerFunction · 0.90
ProxyMenuFunction · 0.90

Calls 1

useAuthContextFunction · 0.90

Tested by

no test coverage detected