chore: update resource type checks (#2081)

This commit is contained in:
boojack
2023-08-05 20:17:33 +08:00
committed by GitHub
parent cc400da44e
commit 270a529948
4 changed files with 39 additions and 36 deletions

View File

@ -3,7 +3,7 @@ import React from "react";
import toast from "react-hot-toast";
import { useResourceStore } from "@/store/module";
import { useTranslate } from "@/utils/i18n";
import { getResourceUrl } from "@/utils/resource";
import { getResourceType, getResourceUrl } from "@/utils/resource";
import showChangeResourceFilenameDialog from "./ChangeResourceFilenameDialog";
import { showCommonDialog } from "./Dialog/CommonDialog";
import Icon from "./Icon";
@ -20,7 +20,7 @@ const ResourceItemDropdown = ({ resource }: Props) => {
const handlePreviewBtnClick = (resource: Resource) => {
const resourceUrl = getResourceUrl(resource);
if (resource.type.startsWith("image")) {
if (getResourceType(resource).startsWith("image")) {
showPreviewImageDialog([getResourceUrl(resource)], 0);
} else {
window.open(resourceUrl);