Browse Source

delete useless imports

Vitalii Polishchuk 3 years ago
parent
commit
c59bcf8ea9

+ 3 - 0
src/actions/index.js

@@ -367,6 +367,9 @@ export const actionFullLogin = (login, password) => {
   return async (dispatch) => {
   return async (dispatch) => {
     let result = await dispatch(actionLogin(login, password))
     let result = await dispatch(actionLogin(login, password))
     console.log(result)
     console.log(result)
+    if (!result) {
+      alert("Лажа, проверьте пароль и логин")
+    }
     dispatch(actionAuthLogin(result))
     dispatch(actionAuthLogin(result))
   }
   }
 }
 }

+ 6 - 6
src/components/dropzone.js

@@ -14,13 +14,13 @@ export const MyDropzone = ({ maxFiles, onUpload, onSet }) => {
         onSet(files)
         onSet(files)
     }, [onUpload, onSet])
     }, [onUpload, onSet])
 
 
-    const { acceptedFiles, getRootProps, getInputProps } = useDropzone({ onDrop, maxFiles: maxFiles })
+    const { getRootProps, getInputProps } = useDropzone({ onDrop, maxFiles: maxFiles })
 
 
-    const files = acceptedFiles.map(file => (
-        <li key={file.path}>
-            {file.path} - {file.size} bytes
-        </li>
-    ))
+    // const files = acceptedFiles.map(file => (
+    //     <li key={file.path}>
+    //         {file.path} - {file.size} bytes
+    //     </li>
+    // ))
 
 
     return (
     return (
         <div>
         <div>

+ 2 - 2
src/components/message.js

@@ -1,8 +1,8 @@
 import ReactTimeAgo from 'react-time-ago'
 import ReactTimeAgo from 'react-time-ago'
 import TimeAgo from 'javascript-time-ago'
 import TimeAgo from 'javascript-time-ago'
 import ru from 'javascript-time-ago/locale/ru.json'
 import ru from 'javascript-time-ago/locale/ru.json'
-import { useCallback, useState, useEffect, useRef } from 'react'
-import { ListItem, Menu, MenuItem } from '@mui/material'
+import { useState } from 'react'
+import { Menu, MenuItem } from '@mui/material'
 
 
 TimeAgo.addLocale(ru)
 TimeAgo.addLocale(ru)
 
 

+ 0 - 19
src/components/profileBar.js

@@ -9,18 +9,10 @@ import MenuItem from '@mui/material/MenuItem';
 import ListItemIcon from '@mui/material/ListItemIcon';
 import ListItemIcon from '@mui/material/ListItemIcon';
 import Divider from '@mui/material/Divider';
 import Divider from '@mui/material/Divider';
 import IconButton from '@mui/material/IconButton';
 import IconButton from '@mui/material/IconButton';
-import Typography from '@mui/material/Typography';
 import Tooltip from '@mui/material/Tooltip';
 import Tooltip from '@mui/material/Tooltip';
-import PersonAdd from '@mui/icons-material/PersonAdd';
-import Settings from '@mui/icons-material/Settings';
 import Logout from '@mui/icons-material/Logout';
 import Logout from '@mui/icons-material/Logout';
-import { ListItem } from "@mui/material";
 import { Link } from "react-router-dom";
 import { Link } from "react-router-dom";
 
 
-export default function AccountMenu() {
-
-}
-
 const Profile = ({ user, onLogout }) => {
 const Profile = ({ user, onLogout }) => {
     const [anchorEl, setAnchorEl] = useState(null);
     const [anchorEl, setAnchorEl] = useState(null);
     const open = Boolean(anchorEl);
     const open = Boolean(anchorEl);
@@ -33,17 +25,6 @@ const Profile = ({ user, onLogout }) => {
         setAnchorEl(null);
         setAnchorEl(null);
     }
     }
     return (
     return (
-        // <>
-        //     {user && <div>
-        //         {user.avatar ?
-        //             <Avatar src={user.avatar.url} alt={user.login} />
-        //             :
-        //             <Avatar>{(user.nick && user.nick[0]) || user.login[0]}</Avatar>}
-        //         <span>{user.nick || user.login}</span>
-        //         <a href="/profile">Редактировать профиль</a>
-        //         <Button onClick={() => onLogout()}>Выйти</Button>
-        //     </div>}
-        // </>
 
 
         <>
         <>
             <Box sx={{ display: 'flex', alignItems: 'center', textAlign: 'center' }}>
             <Box sx={{ display: 'flex', alignItems: 'center', textAlign: 'center' }}>

+ 1 - 1
src/pages/main.js

@@ -12,7 +12,7 @@ import {
     actionEditMSGback, actionFullGetChats, actionFullGetMessages,
     actionEditMSGback, actionFullGetChats, actionFullGetMessages,
     actionGetUserInfo, actionUploadFile
     actionGetUserInfo, actionUploadFile
 } from "../actions";
 } from "../actions";
-import { Grid, Container, AppBar } from "@mui/material";
+import { Grid } from "@mui/material";
 
 
 const Main = ({ match: { params: { _id } }, userID, chats, isLoad, getUserInfo, getChat, getMessages, addChat, addMSG, editMSG, sendMSG, addFile }) => {
 const Main = ({ match: { params: { _id } }, userID, chats, isLoad, getUserInfo, getChat, getMessages, addChat, addMSG, editMSG, sendMSG, addFile }) => {
     let [isEdit, setIsEdit] = useState(false)
     let [isEdit, setIsEdit] = useState(false)

+ 4 - 2
src/reducers/auth.js

@@ -11,8 +11,10 @@ function authReducer(state, { type, token }) {
     }
     }
 
 
     if (type === "LOGIN") {
     if (type === "LOGIN") {
-        localStorage.authToken = token
-        return { token, payload: JSON.parse(atob(token.split(".")[1])) }
+        if (token) {
+            localStorage.authToken = token
+            return { token, payload: JSON.parse(atob(token.split(".")[1])) }
+        }
     }
     }
     if (type === "LOGOUT") {
     if (type === "LOGOUT") {
         localStorage.removeItem("authToken")
         localStorage.removeItem("authToken")