Browse Source

Handle nullability of config fields

pull/972/head
William Oldham 1 year ago
parent
commit
404d3b885f
  1. 2
      src/hooks/auth/useBackendUrl.ts
  2. 2
      src/pages/parts/admin/TMDBTestPart.tsx
  3. 2
      src/pages/parts/settings/SidebarPart.tsx

2
src/hooks/auth/useBackendUrl.ts

@ -1,7 +1,7 @@
import { conf } from "@/setup/config"; import { conf } from "@/setup/config";
import { useAuthStore } from "@/stores/auth"; import { useAuthStore } from "@/stores/auth";
export function useBackendUrl(): string | undefined { export function useBackendUrl(): string | null {
const backendUrl = useAuthStore((s) => s.backendUrl); const backendUrl = useAuthStore((s) => s.backendUrl);
return backendUrl ?? conf().BACKEND_URL; return backendUrl ?? conf().BACKEND_URL;
} }

2
src/pages/parts/admin/TMDBTestPart.tsx

@ -25,7 +25,7 @@ export function TMDBTestPart() {
errorText: "", errorText: "",
}); });
if (tmdbApiKey.length === 0) { if (!tmdbApiKey || tmdbApiKey.length === 0) {
return setStatus({ return setStatus({
hasTested: true, hasTested: true,
success: false, success: false,

2
src/pages/parts/settings/SidebarPart.tsx

@ -14,7 +14,7 @@ import { useAuthStore } from "@/stores/auth";
const rem = 16; const rem = 16;
function SecureBadge(props: { url: string | undefined }) { function SecureBadge(props: { url: string | null }) {
const { t } = useTranslation(); const { t } = useTranslation();
const secure = props.url ? props.url.startsWith("https://") : false; const secure = props.url ? props.url.startsWith("https://") : false;
return ( return (

Loading…
Cancel
Save