Commit 998b966b authored by Lê Bảo Hồng Đức's avatar Lê Bảo Hồng Đức

fixnews

parent 0a8e85f9
...@@ -22,11 +22,8 @@ import { Button } from "@/components/ui/button"; ...@@ -22,11 +22,8 @@ import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox"; import { Checkbox } from "@/components/ui/checkbox";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import logo from "@/assets/VCCI-HCM-logo-VN-2025.png";
import links, { resolveUploadUrl } from "@/links";
import { loginAdmin } from "@/lib/auth/admin-auth"; import { loginAdmin } from "@/lib/auth/admin-auth";
import useAuthStore from "@/store/useAuthStore"; import useAuthStore from "@/store/useAuthStore";
import { fetchCmsFileById, resolveCmsFileUrl } from "@/lib/api/files";
type AuthMode = "login" | "forgot"; type AuthMode = "login" | "forgot";
...@@ -121,18 +118,9 @@ function AuthShell({ ...@@ -121,18 +118,9 @@ function AuthShell({
} }
); );
// Resolve logo URL: prefer logo_url, otherwise fetch file by file_id. // Always use the static /logo.png from public/ for the login screen so the
const { data: logoFile } = useQuery({ // logo renders reliably regardless of backend logo/upload state.
queryKey: ["cms-file", logoData?.file_id], const logoSrc = "/logo.png";
queryFn: () => fetchCmsFileById(logoData!.file_id),
enabled: !!logoData?.file_id && !logoData?.logo_url,
});
const logoSrc = logoData?.logo_url
? resolveUploadUrl(logoData.logo_url)
: logoFile
? resolveCmsFileUrl(logoFile.path)
: logo;
const title = const title =
mode === "login" mode === "login"
......
...@@ -385,8 +385,14 @@ export function AdminRichTextEditor({ ...@@ -385,8 +385,14 @@ export function AdminRichTextEditor({
""; "";
// Resolve to a full URL so the image preview renders inside the editor. // Resolve to a full URL so the image preview renders inside the editor.
const resolvedUrl = rawUrl ? resolveUploadUrl(rawUrl) : ""; const resolvedUrl = rawUrl ? resolveUploadUrl(rawUrl) : "";
// isImages tells Jodit's defaultHandlerSuccess to insert an <img>
// tag instead of an <a> link. Without it, uploaded images render as
// plain text links inside the editor and on the client.
const mime = typeof responseData?.mime === "string" ? responseData.mime : "";
const isImage = mime.startsWith("image/") || /\.(png|jpe?g|gif|webp|svg|bmp|avif)$/i.test(resolvedUrl);
return { return {
files: resolvedUrl ? [resolvedUrl] : [], files: resolvedUrl ? [resolvedUrl] : [],
isImages: resolvedUrl ? [isImage] : [],
baseurl: "", baseurl: "",
error: resolvedUrl ? undefined : (r.message as string) || "Upload failed", error: resolvedUrl ? undefined : (r.message as string) || "Upload failed",
msg: (r.message as string) || "", msg: (r.message as string) || "",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment