Skip to content

Commit

Permalink
Add "Unknown auth type" error in Users table
Browse files Browse the repository at this point in the history
  • Loading branch information
N2D4 committed Jul 20, 2024
1 parent 6d24b4f commit ab0ec93
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/dashboard/src/components/data-table/user-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { DataTable } from "./elements/data-table";
import { DataTableFacetedFilter } from "./elements/faceted-filter";
import { SearchToolbarItem } from "./elements/toolbar-items";
import { standardFilterFn } from "./elements/utils";
import { throwErr } from '@stackframe/stack-shared/dist/utils/errors';

export type ExtendedServerUser = ServerUser & {
authType: string,
Expand Down Expand Up @@ -204,7 +205,7 @@ const columns: ColumnDef<ExtendedServerUser>[] = [
export function extendUsers(users: ServerUser[]): ExtendedServerUser[] {
return users.map((user) => ({
...user,
authType: (user.emailAuthEnabled ? "email" : user.oauthProviders[0].id) || "",
authType: (user.emailAuthEnabled ? "email" : (user.oauthProviders[0]?.id ?? throwErr(`Unknown auth type for user ${user.displayName} — neither e-mail nor OAuth enabled`))) || "",
emailVerified: user.primaryEmailVerified ? "verified" : "unverified",
} satisfies ExtendedServerUser)).sort((a, b) => a.signedUpAt > b.signedUpAt ? -1 : 1);
}
Expand Down

0 comments on commit ab0ec93

Please sign in to comment.