From 826c7c47785ee01d2b9267919132ada696425344 Mon Sep 17 00:00:00 2001 From: Melonai Date: Wed, 20 Jan 2021 23:18:09 +0100 Subject: Remade the client in SvelteKit --- client/src/Components/Response.js | 55 --------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 client/src/Components/Response.js (limited to 'client/src/Components/Response.js') diff --git a/client/src/Components/Response.js b/client/src/Components/Response.js deleted file mode 100644 index f69000a..0000000 --- a/client/src/Components/Response.js +++ /dev/null @@ -1,55 +0,0 @@ -import React, {useEffect, useState} from 'react'; -import axios from "axios"; -import Loader from "./Loader"; -import CopyButton from "./CopyButton"; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faBomb } from '@fortawesome/free-solid-svg-icons'; - -function Response(props){ - const CancelToken = axios.CancelToken; - const [requestState, setRequestState] = useState({loading: true, cancel: CancelToken.source()}); - - useEffect(() => { - axios.post('/', {url: "https://" + props.url}, {cancelToken: requestState.cancel.token}) - .then((r) => { - setRequestState({loading: false, hash: r.data.hash, cancel: requestState.cancel}); - }).catch((e) => { - if (!axios.isCancel(e)) { - setRequestState({loading: false, error: true, cancel: requestState.cancel}); - } - }); - - return () => { - requestState.cancel.cancel(); - }; - }, [props.url, requestState.cancel]) - - let text; - let rightItem; - if (!requestState.loading) { - if (!requestState.error) { - rightItem = ; - if (props.url.length < 20) { - text = - The short link for {props.url} is
sho.rest/{requestState.hash}
; - } else { - text = - The short link for your URL is
sho.rest/{requestState.hash}
; - } - } else { - rightItem = ; - text = There was an error. - } - } else { - text = - } - - return ( -
-
{text}
- {rightItem} -
- ) -} - -export default Response; \ No newline at end of file -- cgit 1.4.1