mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +00:00
fixed compile warnings
This commit is contained in:
parent
4469e7db95
commit
955efe1d67
@ -5,7 +5,7 @@ import { Login } from './Login/Login';
|
||||
import { Create } from './Create/Create';
|
||||
import { User } from './User/User';
|
||||
import { HashRouter as Router, Routes, Route } from "react-router-dom";
|
||||
import 'antd/dist/antd.css';
|
||||
import 'antd/dist/antd.min.css';
|
||||
|
||||
function App() {
|
||||
|
||||
|
@ -81,15 +81,15 @@ export default function useAppContext() {
|
||||
setAppState({ token: session.token, access: session.access })
|
||||
connectStatus(session.token);
|
||||
} else {
|
||||
setAppState({ })
|
||||
setAppState({})
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
console.log(err)
|
||||
setAppState({ actions: accessActions })
|
||||
setAppState({})
|
||||
}
|
||||
} else {
|
||||
setAppState({ actions: accessActions })
|
||||
setAppState({})
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
import React, { useContext, useState, useEffect, useRef } from 'react'
|
||||
import { AppContext } from '../AppContext/AppContext';
|
||||
import { Input, Button, Spin } from 'antd';
|
||||
import React from 'react'
|
||||
import { UserOutlined, LockOutlined } from '@ant-design/icons';
|
||||
import { useCreate } from './useCreate.hook';
|
||||
import { CreateWrapper, CreateInput, CreatePassword, CreateLogin, CreateEnter, CreateSpin } from './Create.styled';
|
||||
|
@ -4,7 +4,6 @@ import { useNavigate } from "react-router-dom";
|
||||
|
||||
export function useCreate() {
|
||||
const [checked, setChecked] = useState(true)
|
||||
const [conflict, setConflict] = useState('')
|
||||
const [state, setState] = useState({
|
||||
username: '',
|
||||
password: '',
|
||||
@ -29,8 +28,8 @@ export function useCreate() {
|
||||
actions.updateState({ confirmed });
|
||||
},
|
||||
isDisabled: () => {
|
||||
if (state.username != '' && state.password != '' && state.password == state.confirmed &&
|
||||
checked && state.conflict == '') {
|
||||
if (state.username !== '' && state.password !== '' && state.password === state.confirmed &&
|
||||
checked && state.conflict === '') {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -60,7 +59,7 @@ export function useCreate() {
|
||||
clearTimeout(debounce.current)
|
||||
debounce.current = setTimeout(async () => {
|
||||
if (app.actions && app.actions.username) {
|
||||
if (name == '') {
|
||||
if (name === '') {
|
||||
setChecked(true)
|
||||
actions.updateState({ conflict: '' })
|
||||
}
|
||||
@ -80,10 +79,10 @@ export function useCreate() {
|
||||
useEffect(() => {
|
||||
if (app) {
|
||||
if (app.state) {
|
||||
if (app.state.access == 'user') {
|
||||
if (app.state.access === 'user') {
|
||||
navigate('/user')
|
||||
}
|
||||
if (app.state.access == 'admin') {
|
||||
if (app.state.access === 'admin') {
|
||||
navigate('/admin')
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import React, { useContext, useState, useEffect, useRef } from 'react'
|
||||
import React, { useContext, useEffect } from 'react'
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { HashRouter as Router, Routes, Route } from "react-router-dom";
|
||||
import { AppContext } from '../AppContext/AppContext';
|
||||
|
||||
export function Home() {
|
||||
|
@ -1,6 +1,4 @@
|
||||
import React, { useContext, useState, useEffect, useRef } from 'react'
|
||||
import { AppContext } from '../AppContext/AppContext';
|
||||
import { Input, Button } from 'antd';
|
||||
import React from 'react'
|
||||
import { UserOutlined, LockOutlined } from '@ant-design/icons';
|
||||
import { useLogin } from './useLogin.hook';
|
||||
import { LoginWrapper, LoginInput, LoginPassword, LoginCreate, LoginEnter, LoginSpin } from './Login.styled';
|
||||
|
@ -50,17 +50,17 @@ export function useLogin() {
|
||||
useEffect(() => {
|
||||
if (app) {
|
||||
if (app.state) {
|
||||
if (app.state.access == 'user') {
|
||||
if (app.state.access === 'user') {
|
||||
navigate('/user')
|
||||
}
|
||||
if (app.state.access == 'admin') {
|
||||
if (app.state.access === 'admin') {
|
||||
navigate('/admin')
|
||||
}
|
||||
}
|
||||
if (app.actions && app.actions.available) {
|
||||
const count = async () => {
|
||||
const available = await app.actions.available()
|
||||
actions.updateState({ available: available != 0 })
|
||||
actions.updateState({ available: available !== 0 })
|
||||
}
|
||||
count();
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
import React, { useContext, useState, useEffect, useRef } from 'react'
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { HashRouter as Router, Routes, Route } from "react-router-dom";
|
||||
import { AppContext } from '../AppContext/AppContext';
|
||||
import React from 'react'
|
||||
import { useUser } from './useUser.hook';
|
||||
import { Input, Button } from 'antd';
|
||||
import { Button } from 'antd';
|
||||
|
||||
export function User() {
|
||||
|
||||
|
@ -23,7 +23,7 @@ export function useUser() {
|
||||
if (app.state == null) {
|
||||
navigate('/')
|
||||
}
|
||||
else if (app.state.access == 'admin') {
|
||||
else if (app.state.access === 'admin') {
|
||||
navigate('/admin')
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user