fix(app): unreachable-server message without the address
ci / typescript (push) Successful in 13m10s
ci / rust (push) Successful in 11m12s

Claude-Session: https://claude.ai/code/session_01HT6iXLYUUp9pJz5Kza9xCW
This commit is contained in:
spark committed 2026-10-12 00:00:16 +01:00
1 parent 202a1b5abe
commit 20a39b8a6e
3 files changed
+3 -4

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
import { ApiClient } from "@photoreport/sdk";
import { desktopRefreshStore, isDesktop } from "./platform.js";
export const API_URL = (import.meta.env.VITE_API_URL as string | undefined) ?? "http://localhost:3000";
const API_URL = (import.meta.env.VITE_API_URL as string | undefined) ?? "http://localhost:3000";
export function createApi(onSessionLost: () => void): ApiClient {
return new ApiClient({
+1 -1
View File
@@ -10,7 +10,7 @@ export const t = {
rateLimited: "Demasiadas tentativas. Espera um minuto e tenta outra vez.",
accountDisabled: "Esta conta está desativada. Fala com o administrador.",
unexpectedError: "Algo correu mal. Tenta outra vez.",
serverUnreachable: (url: string) => `Sem ligação ao servidor (${url.replace(/^https?:\/\//, "")}). Verifica a internet ou tenta mais tarde.`,
serverUnreachable: "Não foi possível ligar ao servidor.",
signInWithBrowser: "Entrar pelo browser",
desktopIntro: "A app abre o browser para entrares com a tua conta PhotoReport.",
desktopCode: "Confirma que o browser mostra este código:",
+1 -2
View File
@@ -1,6 +1,5 @@
import { ApiError, type DeviceGrant } from "@photoreport/sdk";
import { useEffect, useState, type FormEvent } from "react";
import { API_URL } from "../api.js";
import { useAuth } from "../auth.js";
import { Alert, Button, Field, Logo } from "../components/ui.js";
import { t } from "../i18n.js";
@@ -14,7 +13,7 @@ export function errorMessage(err: unknown): string {
return t.unexpectedError;
}
// fetch rejects (TypeError) when the server can't be reached at all: no network, wrong address, server down.
if (err instanceof TypeError) return t.serverUnreachable(API_URL);
if (err instanceof TypeError) return t.serverUnreachable;
return t.unexpectedError;
}