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