History

Fix web app TypeScript errors in approvals views and auth provider

- database.ts: Use TaskStatus type instead of string for task.status in listPendingApprovals return type so it matches PendingApprovalRecord - convex-provider.tsx: Coerce undefined to null in getAccessToken return to match Convex UseAuth interface

Rhys Sullivan committed 9 months ago

Commit bfdfd721 parent fc207af2 files · +3 −2Browse files

Unified · Split

2 files
  1. executor/apps/web/src/lib/convex-provider.tsx +1 −1
  2. executor/convex/database.ts +2 −1
executor/apps/web/src/lib/convex-provider.tsx+1−1
@@ -21,7 +21,7 @@ function useConvexWorkosAuth() { · 20 unmodified lines
21 return {21 return {
22 isLoading: loading,22 isLoading: loading,
23 user,23 user,
24 getAccessToken,24 getAccessToken: async () => (await getAccessToken()) ?? null,
25 };25 };
26}26}
27 27
executor/convex/database.ts+2−1
@@ -3,6 +3,7 @@ import type { Doc } from "./_generated/dataModel"; · 2 unmodified lines
3import type { MutationCtx, QueryCtx } from "./_generated/server";3import type { MutationCtx, QueryCtx } from "./_generated/server";
4import { mutation, query } from "./_generated/server";4import { mutation, query } from "./_generated/server";
5import { ensureUniqueSlug } from "./lib/slug";5import { ensureUniqueSlug } from "./lib/slug";
6import type { TaskStatus } from "@executor/contracts";
6 7
7const DEFAULT_TIMEOUT_MS = 300_000;8const DEFAULT_TIMEOUT_MS = 300_000;
8type OrganizationRole = "owner" | "admin" | "member" | "billing_admin";9type OrganizationRole = "owner" | "admin" | "member" | "billing_admin";
@@ -558,7 +559,7 @@ export const listPendingApprovals = query({ · 549 unmodified lines
558 559
559 const results: Array<560 const results: Array<
560 ReturnType<typeof mapApproval> & {561 ReturnType<typeof mapApproval> & {
561 task: { id: string; status: string; runtimeId: string; timeoutMs: number; createdAt: number };562 task: { id: string; status: TaskStatus; runtimeId: string; timeoutMs: number; createdAt: number };
562 }563 }
563 > = [];564 > = [];
564 for (let i = 0; i < docs.length; i++) {565 for (let i = 0; i < docs.length; i++) {