Skip to content

Commit ff0783a

Browse files
authored
chore(vscode): make auth status output match (#4408)
1 parent 7403b69 commit ff0783a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

vscode/extension/src/auth/auth.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@ const tokenSchema = z.object({
2828
email: z.string(),
2929
})
3030

31-
const statusResponseSchema = z.object({
32-
is_logged_in: z.boolean(),
33-
id_token: tokenSchema.optional().nullable(),
34-
})
31+
const statusResponseSchema = z.discriminatedUnion('is_logged_in', [
32+
z.object({
33+
is_logged_in: z.literal(true),
34+
id_token: tokenSchema,
35+
}),
36+
z.object({
37+
is_logged_in: z.literal(false),
38+
id_token: z.object({}),
39+
}),
40+
])
3541

3642
type StatusResponse = z.infer<typeof statusResponseSchema>
3743

0 commit comments

Comments
 (0)