version/0.5 #3
|
@ -49,7 +49,7 @@ const Search: React.FC<SearchProps> = ({ setBooks }) => {
|
||||||
const [showLanguageDropdown, setShowLanguageDropdown] = useState<boolean>(true)
|
const [showLanguageDropdown, setShowLanguageDropdown] = useState<boolean>(true)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const params = new Proxy(new URLSearchParams(window.location.search), {
|
const params = new Proxy(new URLSearchParams(decodeURIComponent(window.location.search)), {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
get: (searchParams, prop) => searchParams.get(prop),
|
get: (searchParams, prop) => searchParams.get(prop),
|
||||||
});
|
});
|
||||||
|
@ -94,9 +94,10 @@ const Search: React.FC<SearchProps> = ({ setBooks }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const copyToClipboard = () => {
|
const copyToClipboard = () => {
|
||||||
const searchQuery = `${window.location.host}?title=${title}&author=${author}&language=${language}&publisher=${publisher}&isbn=${isbn}&extension=${extension}`;
|
const searchBase = `${window.location.host}/?`;
|
||||||
|
const searchQuery = encodeURIComponent(`title=${title}&author=${author}&language=${language}&publisher=${publisher}&isbn=${isbn}&extension=${extension}`)
|
||||||
|
|
||||||
navigator.clipboard.writeText(searchQuery).then(() => {
|
navigator.clipboard.writeText(`${searchBase}${searchQuery}`).then(() => {
|
||||||
//console.log('Async: Copying to clipboard was successful!');
|
//console.log('Async: Copying to clipboard was successful!');
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
//console.error('Async: Could not copy text: ', err);
|
//console.error('Async: Could not copy text: ', err);
|
||||||
|
|
Loading…
Reference in New Issue