mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: remove organizationIds from AuthProvider (#13917)
This commit is contained in:
@@ -30,7 +30,6 @@ export type AuthContextValue = {
|
||||
isUpdatingProfile: boolean;
|
||||
user: User | undefined;
|
||||
permissions: Permissions | undefined;
|
||||
organizationIds: readonly string[] | undefined;
|
||||
signInError: unknown;
|
||||
updateProfileError: unknown;
|
||||
signOut: () => void;
|
||||
@@ -119,7 +118,6 @@ export const AuthProvider: FC<PropsWithChildren> = ({ children }) => {
|
||||
permissions: permissionsQuery.data as Permissions | undefined,
|
||||
signInError: loginMutation.error,
|
||||
updateProfileError: updateProfileMutation.error,
|
||||
organizationIds: userQuery.data?.organization_ids,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -95,7 +95,6 @@ describe("useAuthenticated", () => {
|
||||
wrapper: createAuthWrapper({
|
||||
user: MockUser,
|
||||
permissions: MockPermissions,
|
||||
organizationIds: [],
|
||||
}),
|
||||
});
|
||||
}).not.toThrow();
|
||||
|
||||
@@ -74,7 +74,7 @@ type RequireKeys<T, R extends keyof T> = Omit<T, R> & {
|
||||
// values are not undefined when authenticated
|
||||
type AuthenticatedAuthContextValue = RequireKeys<
|
||||
AuthContextValue,
|
||||
"user" | "permissions" | "organizationIds"
|
||||
"user" | "permissions"
|
||||
>;
|
||||
|
||||
export const useAuthenticated = (): AuthenticatedAuthContextValue => {
|
||||
@@ -88,9 +88,5 @@ export const useAuthenticated = (): AuthenticatedAuthContextValue => {
|
||||
throw new Error("Permissions are not available.");
|
||||
}
|
||||
|
||||
if (!auth.organizationIds) {
|
||||
throw new Error("Organization ID is not available.");
|
||||
}
|
||||
|
||||
return auth as AuthenticatedAuthContextValue;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user