Vlad před 5 roky
rodič
revize
724909a91d

+ 0 - 3
src/actions/getUserById.js

@@ -2,9 +2,6 @@ import * as types from "../constants/actionTypes";
 
 const axios = require("axios");
 
-
-
-
 const userAuthRequestById = payload => ({
     type: types.USER_AUTH_REQUEST_BY_ID,
     payload

+ 0 - 3
src/actions/searchStaffAction.js

@@ -2,8 +2,6 @@ import * as types from '../constants/actionTypes';
 
 const axios = require('axios');
 
-
-
 export const changeInputValue = payload => ({
     type: types.CHANGE_INPUT_VALUE,
     payload
@@ -24,7 +22,6 @@ const searchStaffrequestFail = payload => ({
     payload
 })
 
-
 export const searchStaff = payload => {
     return dispatch => {
         dispatch(searchStaffRequest())

+ 0 - 1
src/actions/usersRegistrActions.js

@@ -34,6 +34,5 @@ export const postUsersData = (payload) => {
             .catch(err => {
                 dispatch(userRegRequestFail(err));
             })
-
     };
 };

+ 3 - 4
src/common/authRenderField.js

@@ -2,11 +2,10 @@ import React from "react";
 
 export const authRenderField = ({input, meta: {touched, error}, label, type, placeholder }) => (
     <div className={touched && error ? "form__input-box":"error"}> 
-        {console.log(error)} 
         <label className="form__input-label" htmlFor="origin">
             {label}
-            <input  className="input" type = {type} placeholder = {placeholder} {...input} />
-        </label>
-        {touched && error && <span>{error}</span>}
+            {touched && error ? <input  className="input" style={{"border":"2px solid red"}} type = {type} placeholder = {placeholder}  {...input} /> : <input  className="input" type = {type} placeholder = {placeholder} {...input} /> }
+        </label> 
+        {touched && error && <span className="span_auth">{error}</span>}
     </div>
 );

+ 2 - 2
src/common/regRenderField.js

@@ -4,8 +4,8 @@ export const regRenderField = ({input, meta: {touched, error}, label, type, plac
     <div className="form__input-box">
         <label className="form__input-label" htmlFor="origin">
             {label}
-            <input  className="input" type = {type} placeholder = {placeholder} {...input} />
+            {touched && error ? <input  className="input" style={{"border":"2px solid red"}} type = {type} placeholder = {placeholder}  {...input} /> : <input  className="input" type = {type} placeholder = {placeholder} {...input} /> }
         </label>
-        {touched && error && <span>{error}</span>}
+        {touched && error && <span className="span_reg">{error}</span>}
     </div>
 );

+ 1 - 1
src/components/Auth/authButtons.js

@@ -11,7 +11,7 @@ class Authbuttons extends Component {
                     </button>
                 </Link>
                 <Link to="/registration" >
-                    <button className="buttonAuth">
+                    <button className="butftonAuth">
                         Регистрация
                     </button>
                 </Link>

+ 0 - 1
src/components/Auth/authorisation.js

@@ -16,7 +16,6 @@ const Form = props => {
 
         getUsersData(values);
 
-
     }
     return (
         <div className="formdiv">

+ 7 - 8
src/components/BtnAddNewStaff/index.js

@@ -4,22 +4,21 @@ import { Icon } from 'antd';
 import { Link } from "react-router-dom";
 
 
-
 class BtnAddNewStaff extends Component {
     render() {
-        const {isAdmin, getUser  } = this.props
+        const { isAdmin, getUser } = this.props
         let localS = JSON.parse(localStorage.getItem("login"));
-        
+
         let data;
-        if (localS===null){
-           data =<div><Link to="/auth" className="topbutton"><Icon type="plus" style={{fontSize: '30px'}} /></Link></div> 
+        if (localS === null) {
+            data = <div><Link to="/auth" className="topbutton"><Icon type="plus" style={{ fontSize: '30px' }} /></Link></div>
         }
-        else if(isAdmin!==undefined || getUser.isAdmin!==undefined){
-            data = <div> <Link to="/newStaff" className="topbutton"><Icon type="plus" style={{fontSize: '30px'}} /></Link></div>
+        else if (isAdmin !== undefined || getUser.isAdmin !== undefined) {
+            data = <div> <Link to="/newStaff" className="topbutton"><Icon type="plus" style={{ fontSize: '30px' }} /></Link></div>
         }
         return (
             <Fragment>
-            {data}
+                {data}
             </Fragment>
         );
     }

+ 2 - 0
src/components/FormsAdd/FormAddNewCategory/index.js

@@ -6,6 +6,7 @@ import { bindActionCreators } from 'redux';
 
 import MDSpinner from "react-md-spinner";
 import Form from '../FormAddNewCategory/SendingCategoryForm'
+import LinkHome from "../../Btn/linkHome"
 
 class FormAddNewStaff extends Component {
     componentDidMount() {
@@ -18,6 +19,7 @@ class FormAddNewStaff extends Component {
         
         return (
             <div>
+                <LinkHome />
                <Form AddNewCategory={AddNewCategory} allCategory={allCategory} podcategory={podcategory} />
                {isFetching===true ? <div><MDSpinner size={100} duration={1000} /></div> : null}
             </div>

+ 2 - 1
src/components/FormsAdd/FormAddNewStaff/index.js

@@ -5,8 +5,8 @@ import * as actions from '../../../actions/categoryAction';
 import { bindActionCreators } from 'redux';
 
 import MDSpinner from "react-md-spinner";
-
 import Form from '../FormAddNewStaff/SendingStaffForm'
+import LinkHome from "../../Btn/linkHome"
 
 class FormAddNewStaff extends Component {
     componentDidMount() {
@@ -26,6 +26,7 @@ class FormAddNewStaff extends Component {
         }
         return (
             <Fragment>
+                <LinkHome />
                 {data}
                 {isFetching===true ? <div><MDSpinner size={100} duration={1000} /></div> : null}
             </Fragment>

+ 1 - 1
src/container/UserProfile.js

@@ -53,7 +53,7 @@ class UserProfile extends Component {
                             <p>{getUser.phone}</p>
                             <div className="buttonConteiner">
                                 <Link to="/activeStaffs"><button className="profilLink">Активные Товары</button></Link>
-                                <button className="profilBtn" onClick={this.singOut}><Link to="/">Выход</Link></button>
+                                <Link to="/"><button className="profilBtn" onClick={this.singOut}>Выход</button></Link>
                             </div>
                         </div>
                     </div>

+ 12 - 0
src/style/components/_form.scss

@@ -348,6 +348,18 @@ input[type=number]::-webkit-outer-spin-button {
       left: 160px;
       bottom: 85px;
     }
+    .span_auth{
+      color: red;
+      position: relative;
+      left: 10%;
+      bottom: 5em;
+    }
+    .span_reg{
+      color: red;
+      position: relative;
+      left: 10%;
+      bottom: 5em;
+    }
   }
   //all
   

+ 1 - 0
src/style/components/_formLogin.scss

@@ -205,4 +205,5 @@ h1, .input::-webkit-input-placeholder, .button {
       padding-bottom: 10px;
       padding-top: 10px;
   }
+
   

+ 1 - 1
src/style/components/_userProfil.scss

@@ -41,7 +41,7 @@
         border-radius: 3px;
         padding: 20px;
         width: 210px;
-        color: black;
+        color: white;
         box-shadow: 0 3px 6px 0 rgba(0,0,0,0.2);
         &:hover { 
         transform: translateY(-3px);

+ 4 - 4
src/utils/authValidate.js

@@ -4,15 +4,15 @@ export const authValidate =  values => {
 
     if(!email) {
         
-        error.email = "Required"
+        error.email = "*"
     } else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.]+\.[A-Z]{2,4}$/i.test(email)) {
-        error.email = 'Invalid email address'
+        error.email = "Неверный адрес"
     }
 
     if(!password) {
-        error.password = "Required"
+        error.password = "*"
     }else if(!/^[a-zA-Z0-9]+$/.test(password)) {
-        error.password = "Invalid password"
+        error.password = "Неверный пароль"
     }
 
     return error;

+ 5 - 5
src/utils/regValidate.js

@@ -3,7 +3,7 @@ export const regValidate = values => {
     const error = {};
 
     if (!login) {
-        error.login = "Required" // - true если ничего не надо возвращать
+        error.login = "*" // - true если ничего не надо возвращать
     } else if (login.length > 15) {
         error.login = 'Must be 15 characters or less'
     } else if (!/^[a-zA-Z0-9]+$/.test(login)) {
@@ -11,25 +11,25 @@ export const regValidate = values => {
     }
 
     if (!password) {
-        error.password = "Required"
+        error.password = "*"
     }else if(!/^[a-zA-Z0-9]+$/.test(password)) {
         error.password = "Invalid password"
     }
 
     if (!name) {
-        error.name = "Required"
+        error.name = "*"
     }else if (!/^[a-zA-Z0-9]+$/.test(name)) {
         error.name = "Invalid login"
     }
 
     if (!phone) {
-        error.phone = "Required"
+        error.phone = "*"
     }else if(!/^[0-9-+()]+$/.test(phone)) {
         error.phone = "Invalid phone number"
     }
 
     if (!email) {
-        error.email = "Required"
+        error.email = "*"
     } else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.]+\.[A-Z]{2,4}$/i.test(email)) {
         error.email = 'Invalid email address'
     }