localhost fix
This commit is contained in:
parent
ff6ed19606
commit
6fb3d2bdbe
1 changed files with 9 additions and 1 deletions
|
@ -54,7 +54,15 @@ export default function CreateCard() {
|
|||
const handleCopyUrl = () => {
|
||||
if (state && state.url) {
|
||||
const currentSiteName = window.location.hostname;
|
||||
const url = `https://${currentSiteName}/${state.url.toString()}`;
|
||||
|
||||
let url = undefined;
|
||||
if (currentSiteName === "localhost" || currentSiteName === "0.0.0.0") {
|
||||
const currentPort = window.location.port;
|
||||
url = `http://${currentSiteName}:${currentPort}/${state.url.toString()}`;
|
||||
} else {
|
||||
url = `https://${currentSiteName}/${state.url.toString()}`;
|
||||
}
|
||||
|
||||
navigator.clipboard.writeText(url)
|
||||
.catch(err => {
|
||||
console.error('Failed to copy URL to clipboard:', err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue