This commit is contained in:
oitsjustjose 2021-06-21 22:49:11 -05:00
commit 658a783f6a
8 changed files with 29 additions and 24 deletions

View file

@ -6,16 +6,24 @@ import FileUpload from './components/FileUpload';
import NavBar from './components/modules/NavBar';
import TextUpload from './components/TextUpload';
import UrlShortener from './components/UrlShortener';
import CheckUrlRedirect from './axios/getUrlHandler';
const slug = window.location.pathname.match(/[^/][^/]*/g);
export default () => {
// Check to see if slug is worth trying :)
!!slug && CheckUrlRedirect(slug).then((url) => {
window.location.href = url;
}).catch(() => {});
ReactDOM.render(
<React.StrictMode>
<Router>
<NavBar />
<div style={{ paddingTop: `${3.5}em` }} />
<Route exact path="/" component={UrlShortener} />
<Route exact path="/f" component={FileUpload} />
<Route exact path="/p" component={TextUpload} />
<Route exact path="/code" component={TextUpload} />
<Route exact path="/files" component={FileUpload} />
</Router>
</React.StrictMode>,
document.getElementById('root'),