mirror of
https://github.com/hazemKrimi/touch-programming.git
synced 2026-05-01 18:20:26 +00:00
Add routing
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
.container {
|
||||
text-align: left;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import './index.css';
|
||||
|
||||
function Home() {
|
||||
return (
|
||||
<div className='container'>
|
||||
<h1>Home</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Home;
|
||||
@@ -0,0 +1,3 @@
|
||||
.container {
|
||||
text-align: left;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import './index.css';
|
||||
|
||||
function Languages() {
|
||||
return (
|
||||
<div className='container'>
|
||||
<h1>Languages</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Languages;
|
||||
@@ -0,0 +1,3 @@
|
||||
.container {
|
||||
text-align: left;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import './index.css';
|
||||
|
||||
function NotFound() {
|
||||
return (
|
||||
<div className='container'>
|
||||
<h1>Not Found</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default NotFound;
|
||||
@@ -6,8 +6,10 @@ import Code from 'components/Code';
|
||||
import Stats from 'components/Stats';
|
||||
|
||||
import './index.css';
|
||||
import { useParams } from 'react-router';
|
||||
|
||||
function Typing() {
|
||||
const {lang} = useParams();
|
||||
const [code, setCode] = useState<string>('');
|
||||
const [loaded, setLoaded] = useState<boolean>(false);
|
||||
|
||||
@@ -16,7 +18,7 @@ function Typing() {
|
||||
setCode('');
|
||||
|
||||
const response = await fetch(
|
||||
`${import.meta.env.VITE_API_URL}/generate?lang=lisp`,
|
||||
`${import.meta.env.VITE_API_URL}/generate?lang=${lang}`,
|
||||
);
|
||||
|
||||
if (!response.ok || !response.body) return;
|
||||
|
||||
Reference in New Issue
Block a user