add build serve and start on other things
All checks were successful
Code quality checks / biome (push) Successful in 7s
All checks were successful
Code quality checks / biome (push) Successful in 7s
This commit is contained in:
parent
d1b1d0aeb5
commit
2552d305da
22 changed files with 281 additions and 74 deletions
12
src/views/pages/about.tsx
Normal file
12
src/views/pages/about.tsx
Normal file
|
@ -0,0 +1,12 @@
|
|||
import type { Component } from "solid-js";
|
||||
|
||||
const about: Component = () => {
|
||||
return (
|
||||
<div>
|
||||
<h1>About</h1>
|
||||
<p>This is the about page.</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { about };
|
12
src/views/pages/error.tsx
Normal file
12
src/views/pages/error.tsx
Normal file
|
@ -0,0 +1,12 @@
|
|||
import type { Component } from "solid-js";
|
||||
|
||||
const error: Component = () => {
|
||||
return (
|
||||
<div>
|
||||
<h1>404 - Not Found</h1>
|
||||
<p>The page you're looking for doesn't exist.</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { error };
|
33
src/views/pages/home.tsx
Normal file
33
src/views/pages/home.tsx
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { getClientEnv } from "@lib/envClient";
|
||||
import { useNavigate } from "@solidjs/router";
|
||||
import { onMount } from "solid-js";
|
||||
|
||||
const home = () => {
|
||||
const navigate = useNavigate();
|
||||
const { backendUrl } = getClientEnv();
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
const res = await fetch(`${backendUrl}/auth/session`, {
|
||||
credentials: "include",
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
if (data?.valid) {
|
||||
navigate("/dashboard", { replace: true });
|
||||
} else {
|
||||
navigate("/login", { replace: true });
|
||||
}
|
||||
} else {
|
||||
navigate("/login", { replace: true });
|
||||
}
|
||||
} catch {
|
||||
navigate("/login", { replace: true });
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export { home };
|
19
src/views/pages/login.tsx
Normal file
19
src/views/pages/login.tsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import styles from "@views/css/login.module.css";
|
||||
import type { Component } from "solid-js";
|
||||
|
||||
const login: Component = () => {
|
||||
return (
|
||||
<div class={styles.container}>
|
||||
<h1 class={styles.title}>Login</h1>
|
||||
<form class={styles.form}>
|
||||
<input type="text" placeholder="Username" class={styles.input} />
|
||||
<input type="password" placeholder="Password" class={styles.input} />
|
||||
<button type="submit" class={styles.button}>
|
||||
Login
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { login };
|
Loading…
Add table
Add a link
Reference in a new issue