chore: fix copy to clipboard (#214)

This commit is contained in:
boojack
2022-09-14 19:24:13 +08:00
committed by GitHub
parent 7079faf2b9
commit c5b26e3310
5 changed files with 15 additions and 16 deletions

View File

@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import * as utils from "../helpers/utils";
import copy from "copy-to-clipboard";
import useI18n from "../hooks/useI18n";
import useLoading from "../hooks/useLoading";
import { resourceService } from "../services";
@ -99,7 +99,7 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
};
const handleCopyResourceLinkBtnClick = (resource: Resource) => {
utils.copyTextToClipboard(`${window.location.origin}/o/r/${resource.id}/${resource.filename}`);
copy(`${window.location.origin}/o/r/${resource.id}/${resource.filename}`);
toastHelper.success("Succeed to copy resource link to clipboard");
};