code refactoring

This commit is contained in:
2023-07-31 16:28:58 +02:00
parent b5731759b0
commit c0a424410e
18 changed files with 222 additions and 251 deletions

View File

@@ -13,7 +13,8 @@ import {
} from '@mui/material'
import { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { getHttpEndpoint } from '../utils'
import { useRecoilValue } from 'recoil'
import { serverURL } from '../atoms/settings'
const LoginContainer = styled(Container)({
display: 'flex',
@@ -35,10 +36,12 @@ export default function Login() {
const [secret, setSecret] = useState('')
const [formHasError, setFormHasError] = useState(false)
const url = useRecoilValue(serverURL)
const navigate = useNavigate()
const login = async () => {
const res = await fetch(`${getHttpEndpoint()}/auth/login`, {
const res = await fetch(`${url}/auth/login`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'