Skip to content

Commit

Permalink
Fixed the Share button Link copy issue (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nabeelcodes110 committed Jul 27, 2023
1 parent 7c31761 commit ad1e6f0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/src/Components/Sheet/Sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,11 @@ function Sheet({
const [copyText, setCopyText] = useState("Click to Copy");

const handleClick = () => {
setCopyText(copyText === "Click to Copy" ? "Copied ✓" : "Click to Copy");
navigator.clipboard.writeText(window.location.href);
navigator.clipboard.writeText(window.location.href).then(()=>{
setCopyText("Copied ✓")
}).catch(()=>{
setCopyText("Click to Copy")
});
};

const [editModal, setEditModal] = useState(false);
Expand Down

0 comments on commit ad1e6f0

Please sign in to comment.