1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-10-17 07:27:29 +00:00

🧹 Fix warnings

This commit is contained in:
Steffo 2021-09-17 00:19:53 +02:00
parent 304819726e
commit e98d07227f
7 changed files with 11 additions and 37 deletions

View file

@ -5,12 +5,7 @@ import {useInstance} from "./InstanceContext";
import {navigate} from "@reach/router";
interface GuestBoxProps {
}
export function GuestBox({}: GuestBoxProps): JSX.Element {
export function GuestBox(): JSX.Element {
const instance = useInstance()
const login = useLogin()

View file

@ -4,12 +4,7 @@ import {useInstance} from "./InstanceContext";
import {useLogin} from "./LoginContext";
interface InstanceBoxProps {
}
export function InstanceBox({}: InstanceBoxProps): JSX.Element {
export function InstanceBox(): JSX.Element {
const instance = useInstance()
const login = useLogin()

View file

@ -3,16 +3,10 @@ import {navigate} from "@reach/router";
import {Box, Form, Heading, Idiomatic as I, Panel, useFormState} from "@steffo/bluelib-react"
import {useLogin} from "./LoginContext";
import {useInstance} from "./InstanceContext";
import {FormState} from "@steffo/bluelib-react/dist/hooks/useFormState";
import {AxiosError} from "axios-lab";
interface LoginBoxProps {
}
export function LoginBox({}: LoginBoxProps): JSX.Element {
export function LoginBox(): JSX.Element {
/**
* The {@link InstanceContext}.
*/
@ -24,7 +18,7 @@ export function LoginBox({}: LoginBoxProps): JSX.Element {
const {login, running} = useLogin()
/**
* The {@link FormState} of the username field.
* The FormState of the username field.
*/
const username = useFormState<string>("", value => {
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 => {
if(value === "") return undefined

View file

@ -103,6 +103,6 @@ export function useLoginAxios(config: AxiosRequestConfig) {
}
})
},
[instance, config]
[instance, authHeader, config]
)
}

View file

@ -3,12 +3,7 @@ import {Box, Form, Heading, Panel, Variable} from "@steffo/bluelib-react";
import {useLogin} from "./LoginContext";
interface LogoutBoxProps {
}
export function LogoutBox({}: LogoutBoxProps): JSX.Element {
export function LogoutBox(): JSX.Element {
const login = useLogin()
if(!login.userData) {

View file

@ -7,16 +7,11 @@ import {LogoutBox} from "../components/LogoutBox";
import {GuestBox} from "../components/GuestBox";
interface LoginPageProps {
}
export function LoginPage({}: LoginPageProps): JSX.Element {
export function LoginPage(): JSX.Element {
const {userData} = useLogin()
return (
<>
<div>
<InstanceBox/>
{userData ?
<LogoutBox/>
@ -26,6 +21,6 @@ export function LoginPage({}: LoginPageProps): JSX.Element {
<LoginBox/>
</Chapter>
}
</>
</div>
)
}

View file

@ -4,7 +4,7 @@ import { LoginPage } from "./LoginPage"
import { Heading } from "@steffo/bluelib-react"
export function Router({}) {
export function Router() {
return <>
<Heading level={1}>
Sophon