From 7b6950185ab3262fe534e43d0a309ed120bbb402 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 26 Mar 2025 21:54:54 +0800 Subject: [PATCH] feat(mobile): nativate to invitation screen for api invitation error --- apps/mobile/src/lib/api-fetch.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/mobile/src/lib/api-fetch.ts b/apps/mobile/src/lib/api-fetch.ts index 400a44be0..edef89cb3 100644 --- a/apps/mobile/src/lib/api-fetch.ts +++ b/apps/mobile/src/lib/api-fetch.ts @@ -2,8 +2,10 @@ import type { AppType } from "@follow/shared" import { FetchError, ofetch } from "ofetch" +import { InvitationScreen } from "../screens/(modal)/invitation" import { userActions } from "../store/user/store" import { getCookie } from "./auth" +import { Navigation } from "./navigation/Navigation" import { proxyEnv } from "./proxy-env" const { hc } = require("hono/dist/cjs/client/client") as typeof import("hono/client") @@ -45,6 +47,10 @@ export const apiFetch = ofetch.create({ try { const json = JSON.parse(response._data) console.error(`Request ${request as string} failed with status ${response.status}`, json) + + if (json.code.toString().startsWith("11")) { + Navigation.rootNavigation.presentControllerView(InvitationScreen) + } } catch { console.error(`Request ${request as string} failed with status ${response.status}`, error) }