From 88933a95b57d1ea14f80c4f03f62d62fc8beea2d Mon Sep 17 00:00:00 2001 From: jamesdawsonwd Date: Thu, 18 Apr 2024 16:42:49 +0100 Subject: [PATCH 1/2] fix: make StatusApiResponse type a discrimitive union --- .../auth-client/src/actions/app/status.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/auth-client/src/actions/app/status.ts b/packages/auth-client/src/actions/app/status.ts index af387a9..b8667df 100644 --- a/packages/auth-client/src/actions/app/status.ts +++ b/packages/auth-client/src/actions/app/status.ts @@ -9,17 +9,20 @@ export interface StatusArgs { export type StatusResponse = AsyncUnwrapped>; -export interface StatusAPIResponse { - state: "pending" | "completed"; +export type StatusAPIResponse = { + state: "pending"; + nonce: string; +} | { + state: "completed"; nonce: string; url: string; - message?: string; - signature?: `0x${string}`; - fid?: number; - username?: string; - bio?: string; - displayName?: string; - pfpUrl?: string; + message: string; + signature: `0x${string}`; + fid: number; + username: string; + bio: string; + displayName: string; + pfpUrl: string; verifications?: Hex[]; custody?: Hex; } From 24e907021e55e4bc76409037cd3c8a108b98025c Mon Sep 17 00:00:00 2001 From: jamesdawsonwd Date: Fri, 19 Apr 2024 10:20:31 +0100 Subject: [PATCH 2/2] fix: add correct optional types to StatusAPIResponse completed state --- packages/auth-client/src/actions/app/status.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/auth-client/src/actions/app/status.ts b/packages/auth-client/src/actions/app/status.ts index b8667df..f959b19 100644 --- a/packages/auth-client/src/actions/app/status.ts +++ b/packages/auth-client/src/actions/app/status.ts @@ -19,10 +19,10 @@ export type StatusAPIResponse = { message: string; signature: `0x${string}`; fid: number; - username: string; - bio: string; - displayName: string; - pfpUrl: string; + username?: string; + bio?: string; + displayName?: string; + pfpUrl?: string; verifications?: Hex[]; custody?: Hex; }