aboutsummaryrefslogtreecommitdiff
path: root/client/src/components/Editor/Editor.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/components/Editor/Editor.jsx')
-rw-r--r--client/src/components/Editor/Editor.jsx47
1 files changed, 26 insertions, 21 deletions
diff --git a/client/src/components/Editor/Editor.jsx b/client/src/components/Editor/Editor.jsx
index 0a78ca8..8ff2ff7 100644
--- a/client/src/components/Editor/Editor.jsx
+++ b/client/src/components/Editor/Editor.jsx
@@ -49,29 +49,34 @@ const Editor = () => {
if (response.ok) {
const isURL = URL_REGEX.test(text);
if (isURL) {
- navigator.clipboard.writeText(`${CLIENT_BASE_URL}/r/${data.id}`).then(function () {
- alert("Short URL copied to clipboard!");
- }, function (err) {
- try {
- var successful = document.execCommand('copy');
+ navigator.clipboard.writeText(`${CLIENT_BASE_URL}/r/${data.id}`).then(
+ function () {
alert("Short URL copied to clipboard!");
- } catch (err) {
- console.log('Oops, unable to copy');
- }
- });
- }
- else {
- navigator.clipboard.writeText(`${CLIENT_BASE_URL}/r/${data.id}`).then(function () {
- navigator.clipboard.writeText(`${CLIENT_BASE_URL}/${data.id}`);
- alert("URL copied to clipboard!");
- }, function (err) {
- try {
- var successful = document.execCommand('copy');
+ },
+ function (err) {
+ try {
+ var successful = document.execCommand("copy");
+ alert("Short URL copied to clipboard!");
+ } catch (err) {
+ console.log("Oops, unable to copy");
+ }
+ },
+ );
+ } else {
+ navigator.clipboard.writeText(`${CLIENT_BASE_URL}/r/${data.id}`).then(
+ function () {
+ navigator.clipboard.writeText(`${CLIENT_BASE_URL}/${data.id}`);
alert("URL copied to clipboard!");
- } catch (err) {
- console.log('Oops, unable to copy');
- }
- });
+ },
+ function (err) {
+ try {
+ var successful = document.execCommand("copy");
+ alert("URL copied to clipboard!");
+ } catch (err) {
+ console.log("Oops, unable to copy");
+ }
+ },
+ );
}
navigate(`/${data.id}`);
} else {