Skip to content

Commit

Permalink
fix type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tmgrask committed Sep 19, 2024
1 parent 787ee87 commit 61dfc51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/psiphon/inproxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const InProxyErrorSchema = z.object({
action: z.enum(["inProxyMustUpgrade"]),
});

const InProxyStatusSchema = z.object({
export const InProxyStatusSchema = z.object({
status: z.enum(["running", "stopped", "unknown"]),
});

Expand Down
13 changes: 9 additions & 4 deletions src/psiphon/mockContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
InProxyActivityStats,
InProxyParameters,
InProxyStatus,
InProxyStatusSchema,
getDefaultInProxyParameters,
getZeroedInProxyActivityStats,
} from "@/src/psiphon/inproxy";
Expand Down Expand Up @@ -252,13 +253,17 @@ export function InProxyProvider({ children }: { children: React.ReactNode }) {
}

const getInProxyStatus = React.useCallback(() => {
let state;
if (!inProxyState.synced) {
return { status: "unknown" };
state = { status: "unknown" };
} else {
return inProxyState.running
? { status: "running" }
: { status: "stopped" };
if (inProxyState.running) {
state = { status: "running" };
} else {
state = { status: "stopped" };
}
}
return InProxyStatusSchema.parse(state);
}, [inProxyState]);

async function sendFeedback(): Promise<void> {
Expand Down

0 comments on commit 61dfc51

Please sign in to comment.