refactor: Moved testing stuff into Test component

main
phga 2 years ago
parent ee2286043e
commit ce4fdac3bb
Signed by: phga
GPG Key ID: 5249548AA705F019

@ -1,15 +1,17 @@
import { Route, Routes } from "@solidjs/router";
import { Component, lazy } from "solid-js";
import { Route, Routes } from '@solidjs/router';
import { Component, lazy } from 'solid-js';
// Only load the components if we are navigating to them
const Home = lazy(() => import("./pages/Home"));
const Login = lazy(() => import("./pages/Login"));
const Home = lazy(() => import('./pages/Home'));
const Login = lazy(() => import('./pages/Login'));
const Test = lazy(() => import('./pages/Test'));
const App: Component = () => {
return (
<>
<Routes>
<Route path={["login", "register"]} component={Login} />
<Route path={["/", "*"]} component={Home} />
<Route path={'test'} component={Test} />
<Route path={['login', 'register']} component={Login} />
<Route path={['/', '*']} component={Home} />
</Routes>
</>
);

@ -1,31 +1,7 @@
import { Component } from 'solid-js';
import RestClient from '../api/RestClient';
const Login: Component = () => {
const TEST_USER = {
id: '310c0d24-cc2e-4798-a259-0d49bf2e3a5a',
hash: 'MEIN_HASH',
login: 'phga',
salt: 'MEIN_SALZ',
};
const btnPrimary =
'inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded-full shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out';
return (
<>
<h1 class='text-4xl'>Login</h1>
<button class={btnPrimary} onClick={() => RestClient.GET('/')}>
GET_HOME
</button>
<button
class={btnPrimary}
onClick={() => RestClient.POST('/login', JSON.stringify(TEST_USER))}
>
POST_LOGIN
</button>
</>
);
return <h1 class='text-4xl'>Login</h1>;
};
export default Login;

@ -0,0 +1,37 @@
import { Component } from 'solid-js';
import RestClient from '../api/RestClient';
const Test: Component = () => {
const TEST_USER = {
id: '310c0d24-cc2e-4798-a259-0d49bf2e3a5a',
hash: 'MEIN_HASH',
login: 'phga',
salt: 'MEIN_SALZ',
};
const btnPrimary =
'inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded-full shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out';
return (
<>
<h1 class='text-4xl'>TEST</h1>
<button class={btnPrimary} onClick={() => RestClient.GET('/')}>
GET_HOME
</button>
<button
class={btnPrimary}
onClick={() => RestClient.POST('/login', JSON.stringify(TEST_USER))}
>
POST_LOGIN
</button>
<button class={btnPrimary} onClick={() => RestClient.GET('/user')}>
GET_USER
</button>
<button class={btnPrimary} onClick={() => RestClient.GET('/todo')}>
GET_TODO
</button>
</>
);
};
export default Test;
Loading…
Cancel
Save