mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-23 07:14:21 +00:00
🧹 Fix warnings
This commit is contained in:
parent
6086a979fe
commit
e72fc46e93
7 changed files with 11 additions and 37 deletions
|
@ -5,12 +5,7 @@ import {useInstance} from "./InstanceContext";
|
||||||
import {navigate} from "@reach/router";
|
import {navigate} from "@reach/router";
|
||||||
|
|
||||||
|
|
||||||
interface GuestBoxProps {
|
export function GuestBox(): JSX.Element {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function GuestBox({}: GuestBoxProps): JSX.Element {
|
|
||||||
const instance = useInstance()
|
const instance = useInstance()
|
||||||
const login = useLogin()
|
const login = useLogin()
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,7 @@ import {useInstance} from "./InstanceContext";
|
||||||
import {useLogin} from "./LoginContext";
|
import {useLogin} from "./LoginContext";
|
||||||
|
|
||||||
|
|
||||||
interface InstanceBoxProps {
|
export function InstanceBox(): JSX.Element {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function InstanceBox({}: InstanceBoxProps): JSX.Element {
|
|
||||||
const instance = useInstance()
|
const instance = useInstance()
|
||||||
const login = useLogin()
|
const login = useLogin()
|
||||||
|
|
||||||
|
|
|
@ -3,16 +3,10 @@ import {navigate} from "@reach/router";
|
||||||
import {Box, Form, Heading, Idiomatic as I, Panel, useFormState} from "@steffo/bluelib-react"
|
import {Box, Form, Heading, Idiomatic as I, Panel, useFormState} from "@steffo/bluelib-react"
|
||||||
import {useLogin} from "./LoginContext";
|
import {useLogin} from "./LoginContext";
|
||||||
import {useInstance} from "./InstanceContext";
|
import {useInstance} from "./InstanceContext";
|
||||||
import {FormState} from "@steffo/bluelib-react/dist/hooks/useFormState";
|
|
||||||
import {AxiosError} from "axios-lab";
|
import {AxiosError} from "axios-lab";
|
||||||
|
|
||||||
|
|
||||||
interface LoginBoxProps {
|
export function LoginBox(): JSX.Element {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function LoginBox({}: LoginBoxProps): JSX.Element {
|
|
||||||
/**
|
/**
|
||||||
* The {@link InstanceContext}.
|
* The {@link InstanceContext}.
|
||||||
*/
|
*/
|
||||||
|
@ -24,7 +18,7 @@ export function LoginBox({}: LoginBoxProps): JSX.Element {
|
||||||
const {login, running} = useLogin()
|
const {login, running} = useLogin()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link FormState} of the username field.
|
* The FormState of the username field.
|
||||||
*/
|
*/
|
||||||
const username = useFormState<string>("", value => {
|
const username = useFormState<string>("", value => {
|
||||||
if(value === "") return undefined
|
if(value === "") return undefined
|
||||||
|
@ -32,7 +26,7 @@ export function LoginBox({}: LoginBoxProps): JSX.Element {
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link FormState} of the password field.
|
* The FormState of the password field.
|
||||||
*/
|
*/
|
||||||
const password = useFormState<string>("", value => {
|
const password = useFormState<string>("", value => {
|
||||||
if(value === "") return undefined
|
if(value === "") return undefined
|
||||||
|
|
|
@ -103,6 +103,6 @@ export function useLoginAxios(config: AxiosRequestConfig) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
[instance, config]
|
[instance, authHeader, config]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,7 @@ import {Box, Form, Heading, Panel, Variable} from "@steffo/bluelib-react";
|
||||||
import {useLogin} from "./LoginContext";
|
import {useLogin} from "./LoginContext";
|
||||||
|
|
||||||
|
|
||||||
interface LogoutBoxProps {
|
export function LogoutBox(): JSX.Element {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function LogoutBox({}: LogoutBoxProps): JSX.Element {
|
|
||||||
const login = useLogin()
|
const login = useLogin()
|
||||||
|
|
||||||
if(!login.userData) {
|
if(!login.userData) {
|
||||||
|
|
|
@ -7,16 +7,11 @@ import {LogoutBox} from "../components/LogoutBox";
|
||||||
import {GuestBox} from "../components/GuestBox";
|
import {GuestBox} from "../components/GuestBox";
|
||||||
|
|
||||||
|
|
||||||
interface LoginPageProps {
|
export function LoginPage(): JSX.Element {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function LoginPage({}: LoginPageProps): JSX.Element {
|
|
||||||
const {userData} = useLogin()
|
const {userData} = useLogin()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div>
|
||||||
<InstanceBox/>
|
<InstanceBox/>
|
||||||
{userData ?
|
{userData ?
|
||||||
<LogoutBox/>
|
<LogoutBox/>
|
||||||
|
@ -26,6 +21,6 @@ export function LoginPage({}: LoginPageProps): JSX.Element {
|
||||||
<LoginBox/>
|
<LoginBox/>
|
||||||
</Chapter>
|
</Chapter>
|
||||||
}
|
}
|
||||||
</>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { LoginPage } from "./LoginPage"
|
||||||
import { Heading } from "@steffo/bluelib-react"
|
import { Heading } from "@steffo/bluelib-react"
|
||||||
|
|
||||||
|
|
||||||
export function Router({}) {
|
export function Router() {
|
||||||
return <>
|
return <>
|
||||||
<Heading level={1}>
|
<Heading level={1}>
|
||||||
Sophon
|
Sophon
|
||||||
|
|
Loading…
Reference in a new issue