diff --git a/VoidCat/spa/src/TextPreview.css b/VoidCat/spa/src/TextPreview.css index 18e9d69..d35fb4a 100644 --- a/VoidCat/spa/src/TextPreview.css +++ b/VoidCat/spa/src/TextPreview.css @@ -3,4 +3,5 @@ padding: 10px; border-radius: 10px; text-align: initial; + overflow: auto; } \ No newline at end of file diff --git a/VoidCat/spa/src/TextPreview.js b/VoidCat/spa/src/TextPreview.js index 9c5b60e..10c3dcb 100644 --- a/VoidCat/spa/src/TextPreview.js +++ b/VoidCat/spa/src/TextPreview.js @@ -5,15 +5,24 @@ export function TextPreview(props) { let [content, setContent] = useState("Loading.."); async function getContent(link) { - let req = await fetch(link); + let req = await fetch(`${link}?t=${new Date().getTime()}`, { + headers: { + "pragma": "no-cache", + "cache-control": "no-cache" + } + }); if (req.ok) { setContent(await req.text()); + } else { + setContent("ERROR :(") } } useEffect(() => { - getContent(props.link); - }, []); + if (props.link !== undefined && props.link !== "#") { + getContent(props.link); + } + }, [props.link]); return (
{content}