4 次代码提交 ec1882a312 ... 425558a2ec

作者 SHA1 备注 提交日期
  Maxim 425558a2ec Added img loaders hadnling 5 年之前
  Maxim d762e9c20f Merged Sveta -> Maxim 5 年之前
  Maxim 5fde374c12 Merge branch 'Maxim' into dev 5 年之前
  sveta a9775a9cc4 get, delete users 5 年之前
共有 32 个文件被更改,包括 446 次插入124 次删除
  1. 16 0
      src/actions/adminActions/deleteUser/index.js
  2. 5 5
      src/actions/adminActions/index.js
  3. 4 6
      src/actions/auth/users/users.js
  4. 1 2
      src/actions/auth/index.js
  5. 6 0
      src/components/common/protectedRoute/config.js
  6. 0 1
      src/components/common/protectedRoute/index.js
  7. 3 0
      src/components/public-components/auth/signUpForm/index.js
  8. 34 22
      src/components/public-components/header/index.js
  9. 48 24
      src/components/public-components/landingPage/index.js
  10. 33 10
      src/components/public-components/notFound/index.js
  11. 43 0
      src/components/user-components/admin-components/createDeleteUser/deleteUser/index.js
  12. 61 0
      src/components/user-components/admin-components/createDeleteUser/formGetUsers/index.js
  13. 36 12
      src/components/user-components/admin-components/createDeleteUser/index.js
  14. 1 1
      src/components/user-components/homePage/index.js
  15. 1 1
      src/components/user-components/profilePage/LoginFild/index.js
  16. 5 4
      src/components/user-components/profilePage/index.js
  17. 13 4
      src/constants/index.js
  18. 30 0
      src/reducers/getUser/index.js
  19. 5 1
      src/reducers/index.js
  20. 10 0
      src/reducers/initialState/index.js
  21. 30 0
      src/reducers/users/index.js
  22. 1 2
      src/saga/auth/index.js
  23. 0 19
      src/saga/auth/users/users.js
  24. 18 0
      src/saga/userFields/deleteUser/index.js
  25. 18 0
      src/saga/userFields/getUser/index.js
  26. 4 4
      src/saga/userFields/createDeleteUser/index.js
  27. 7 2
      src/saga/userFields/index.js
  28. 1 1
      src/state/index.js
  29. 1 1
      src/styles/base/_base.scss
  30. 6 1
      src/styles/components/_header.scss
  31. 4 0
      src/styles/components/_profilePage.scss
  32. 1 1
      src/styles/components/_signPage.scss

+ 16 - 0
src/actions/adminActions/deleteUser/index.js

@@ -0,0 +1,16 @@
+import * as types from '../../../constants';
+
+export const deleteUserRequest = payload => ({
+    type: types.DELETE_USER_REQUEST,
+    payload
+})
+
+export const deleteUserRequestSucces = payload => ({
+    type: types.DELETE_USER_REQUEST_SUCCESS,
+    payload
+})
+
+export const deleteUserRequestFailure = error => ({
+    type: types.DELETE_USER_REQUEST_FAILURE,
+    error
+})

+ 5 - 5
src/actions/adminActions/index.js

@@ -1,16 +1,16 @@
-import * as types from '../../constants';
+import * as types from '../../../constants';
 
 export const userGetRequest = payload => ({
-    type: types.USERS_GET_REQUEST,
+    type: types.USER_GET_REQUEST,
     payload
 })
 
 export const userGetRequestSucces = payload => ({
-    type: types.USERS_GET_REQUEST_SUCCESS,
+    type: types.USER_GET_REQUEST_SUCCESS,
     payload
 })
 
 export const userGetRequestFailure = error => ({
-    type: types.USERS_GET_REQUEST_FAILURE,
+    type: types.USER_GET_REQUEST_FAILURE,
     error
-})
+})

+ 4 - 6
src/actions/auth/users/users.js

@@ -1,10 +1,7 @@
 import * as types from '../../../constants';
 
-// all actions for signing up
-
-export const usersGetRequest= payload => ({
+export const usersGetRequest = () => ({
     type: types.USERS_GET_REQUEST,
-    payload
 })
 
 export const usersGetRequestSucces = payload => ({
@@ -13,6 +10,7 @@ export const usersGetRequestSucces = payload => ({
 })
 
 export const usersGetRequestFailure = error => ({
-    type: types.USERS_GET_REQUEST_SUCCESS_FAILURE ,
+    type: types.USERS_GET_REQUEST_FAILURE,
     error
-})
+})
+

+ 1 - 2
src/actions/auth/index.js

@@ -1,11 +1,10 @@
 import * as signInActions from './signIn';
 import * as signUpActions from './signUp';
 import * as signOutActions from './signOut';
-import * as usersGetActions from './signOut';
+
 
 export default {
     ...signInActions,
     ...signUpActions,
     ...signOutActions,
-    ...usersGetActions
 }

+ 6 - 0
src/components/common/protectedRoute/config.js

@@ -2,6 +2,7 @@ import React from 'react';
 import * as routes from './../../../constants/routes';
 import { lazy } from 'react';
 
+const DeleteUsers =    lazy(()=>import('../../user-components/admin-components/createDeleteUser/index'))
 const LandingPage =    lazy(() => import('./../../public-components/landingPage'));
 const HomePage =       lazy(() => import('./../../user-components/homePage'));
 const SignInPage =     lazy(() => import('./../../../containers/auth/SignInPage'));
@@ -48,6 +49,11 @@ export default [
         access: 'user-only',
         component: CardsPage
     },
+    {
+        path: routes.DELETE_USER ,
+        access: 'admin-only',
+        component: DeleteUsers
+    },
     {
         access: 'public',
         component: NotFound

+ 0 - 1
src/components/common/protectedRoute/index.js

@@ -45,7 +45,6 @@ export default ({ component: Component, user: { data }, tokenAuth, access, ...re
 
                 return <PermissionDenied />
             }
-
         }}
     />
 )

+ 3 - 0
src/components/public-components/auth/signUpForm/index.js

@@ -30,6 +30,9 @@ class Form extends React.Component {
                 </div>
 
                 <button className="sign-form__link--with-margin link--btn link--btn6s0" disabled={invalid}>Create Account</button>
+
+                <hr className="sign-form__divider" />
+
                 <p className="sign-form__agreement">By clicking this button you actually would donate us your flat !</p>
             </form>
         )

+ 34 - 22
src/components/public-components/header/index.js

@@ -5,81 +5,93 @@ import * as routes from './../../../constants/routes';
 import token from './../../../utils/token';
 
 export default class header extends Component {
+    /*
+        TODO: 
+        - add toggler for admin panel
+        - disable marking and background hover effect in the nav panel 
+    */
 
     state = {
-        togglerClosed: true
+        navTogglerClosed: true,
+        adminToggleClosed: true
     }
 
-    handleClick = () => {
+    handleLinkClick = () => {
         this.setState({ togglerClosed: true })
     }
 
-    handleToggle = event => {
-        this.setState((prevState) => ({ togglerClosed: !prevState.togglerClosed }))
+    handleNavToggle = () => {
+        this.setState((prevState) => ({ navTogglerClosed: !prevState.navTogglerClosed }))
+    }
+
+    handleAdminToggle = () => {
+        this.setState({
+
+        })
     }
 
     handleSignOut = () => {
-        console.log("signOut", this.props);
         this.props.signOut();
         localStorage.removeItem(token);
     }
 
     render() {
-        const { togglerClosed } = this.state;
+        const { navTogglerClosed, adminToggleClosed } = this.state;
         const { user: { data } } = this.props;
-        const toggleStatus = togglerClosed ? "toggle-status--closed" : "toggle-status--opened";
+        const navToggleStatus = navTogglerClosed ? "nav-toggle-status--closed" : "nav-toggle-status--opened";
+        const adminToggleStatus = adminToggleClosed ? "admin-toggle-status--closed" : "admin-toggle-status--opened";
 
         return (
             <header className="header">
-                <Link onClick={this.handleClick} to={routes.LANDING}>
+                <Link onClick={this.handleLinkClick} to={routes.LANDING}>
                     <h1 className="header__logo">Test.<span className="header__logo--i-letter">i</span>o</h1>
                 </Link>
                 <hr className="header__logo--divider" />
-                <span className="header__toggle-trigger" onClick={this.handleToggle} >
+                <span className="header__toggle-trigger" onClick={this.handleNavToggle} >
                     <span />
                 </span>
                 <div className="header__flex-wrapper">
-                    <nav className={`header__nav ${toggleStatus}`}>
-                        <ul className="header__nav nav__list"  >
+                    <nav className={`header__nav ${navToggleStatus}`}>
+                        <ul className="header__nav nav__list">
                             <li>
-                                <Link onClick={this.handleClick} className="header__nav nav__list-item" to={routes.HOME}>
+                                <Link onClick={this.handleLinkClick} className="header__nav nav__list-item" to={routes.HOME}>
                                     Home
                                 </Link>
                             </li>
                             <li>
-                                <Link onClick={this.handleClick} className="header__nav nav__list-item" to={routes.PROFILE}>
+                                <Link onClick={this.handleLinkClick} className="header__nav nav__list-item" to={routes.PROFILE}>
                                     Profile
                                 </Link>
                             </li>
                             <li>
-                                <Link onClick={this.handleClick} className="header__nav nav__list-item" to={routes.TESTS}>
+                                <Link onClick={this.handleLinkClick} className="header__nav nav__list-item" to={routes.TESTS}>
                                     Test
                                 </Link>
                             </li>
                             <li>
-                                <Link onClick={this.handleClick} className="header__nav nav__list-item" to={routes.CATEGORIES}>
+                                <Link onClick={this.handleLinkClick} className="header__nav nav__list-item" to={routes.CATEGORIES}>
                                     Categories
                                 </Link>
                             </li>
                             {
                                 data && data.is_admin && (
-                                    <React.Fragment>
+                                    <div className={`header__nav ${adminToggleStatus}`}>
                                         <li>
-                                            <Link onClick={this.handleClick} className="header__nav nav__list-item--admin-only" to={routes.CREATE_TEST}>
+                                            <Link onClick={this.handleLinkClick} className="header__nav nav__list-item--admin-only" to={routes.CREATE_TEST}>
                                                 Create test
                                             </Link>
                                         </li>
                                         <li>
-                                            <Link onClick={this.handleClick} className="header__nav nav__list-item--admin-only" to={routes.CREATE_CATEGORY}>
+                                            <Link onClick={this.handleLinkClick} className="header__nav nav__list-item--admin-only" to={routes.CREATE_CATEGORY}>
                                                 Create category
                                             </Link>
                                         </li>
                                         <li>
-                                            <Link onClick={this.handleClick} className="header__nav nav__list-item--admin-only" to={routes.DELETE_USER}>
+                                            <Link onClick={this.handleLinkClick} className="header__nav nav__list-item--admin-only" to={routes.DELETE_USER}>
                                                 Delete data
                                             </Link>
                                         </li>
-                                    </React.Fragment>
+                                    </div>
                                 )
                             }
                         </ul>
@@ -90,8 +102,8 @@ export default class header extends Component {
                             !data
                                 ? (
                                     <React.Fragment>
-                                        <Link onClick={this.handleClick} className="header__links--sign-in link--btn link--btn25" to={routes.SIGN_IN}>Sign in</Link>
-                                        <Link onClick={this.handleClick} className="header__links--sign-up link--btn link--btn25" to={routes.SIGN_UP}>Sign up</Link>
+                                        <Link onClick={this.handleLinkClick} className="header__links--sign-in link--btn link--btn25" to={routes.SIGN_IN}>Sign in</Link>
+                                        <Link onClick={this.handleLinkClick} className="header__links--sign-up link--btn link--btn25" to={routes.SIGN_UP}>Sign up</Link>
                                     </React.Fragment>
                                 )
                                 : (

+ 48 - 24
src/components/public-components/landingPage/index.js

@@ -1,28 +1,52 @@
 import React from 'react';
 import { Link } from 'react-router-dom';
+import Spinner from './../../common/spinner';
 import * as routes from './../../../constants/routes'
 
-export default props => (
-    <div className="page landing-page">
-        <div className="container landing-page__about">
-            <h1 className="description__header">
-                We are the powerfull servise providing you the ability to create and manage
-                your own tests, in any categories, choosing your own marking methods.
-            </h1>
-            <hr className="description__divider" />
-            <p className="description__main">
-                You can <span className="description__inline--pretty">share</span>
-                {" "}your test with anybody you'd like: no matter your friend or college or even subordinates
-                can easily pass them, get marks and <span className="description__inline--pretty">share</span> ones!
-            </p>
-        </div>
-        <div className="container landing-page__links-container">
-            <Link to={routes.SIGN_IN} className="landing-page__links landing-page__links--sign-in">
-                Sign in
-            </Link>
-            <Link to={routes.SIGN_UP} className="landing-page__links landing-page__links--sign-up">
-                Sign up
-            </Link>
-        </div>
-    </div>
-)
+export default class LandingPage extends React.Component {
+    state = {
+        isLoading: true
+    }
+
+    componentDidMount() {
+        const banner = new Image();
+        banner.src = "https://structureofintellect.files.wordpress.com/2017/09/bubble-test.jpg";
+        banner.onload = () => this.setState({
+            isLoading: false
+        })
+    }
+
+    render() {
+        const { isLoading } = this.state;
+
+        return (
+            isLoading
+                ? <Spinner />
+                : (
+
+                    <div className="page landing-page">
+                        <div className="container landing-page__about">
+                            <h1 className="description__header">
+                                We are the powerfull servise providing you the ability to create and manage
+                                your own tests, in any categories, choosing your own marking methods.
+                        </h1>
+                            <hr className="description__divider" />
+                            <p className="description__main">
+                                You can <span className="description__inline--pretty">share</span>
+                                {" "}your test with anybody you'd like: no matter your friend or college or even subordinates
+                            can easily pass them, get marks and <span className="description__inline--pretty">share</span> ones!
+                        </p>
+                        </div>
+                        <div className="container landing-page__links-container">
+                            <Link to={routes.SIGN_IN} className="landing-page__links landing-page__links--sign-in">
+                                Sign in
+                        </Link>
+                            <Link to={routes.SIGN_UP} className="landing-page__links landing-page__links--sign-up">
+                                Sign up
+                        </Link>
+                        </div>
+                    </div>
+                )
+        )
+    }
+}

+ 33 - 10
src/components/public-components/notFound/index.js

@@ -1,12 +1,35 @@
 import React from 'react';
 import { Link } from 'react-router-dom';
-import { HOME } from './../../../constants/routes'
-
-export default props => (
-    <div className="page not-found">
-        <img className="not-found__image" src="http://kiwanismiracleleague.org/wp-content/themes/chillibox/media/images/404.png" alt="404" />
-        <hr className="not-found__divider"/>
-        <h1 className="not-found__message">Sorry, but looks like nobody lives here...</h1>
-        <p><Link className="link--btn link--btn-big not-found__link--home" to={HOME}>Go home</Link></p>
-    </div>
-)
+import { HOME } from './../../../constants/routes';
+import Spinner from './../../common/spinner'
+
+export default class NotFound extends React.Component {
+    state = {
+        isLoading: true
+    }
+
+    componentDidMount() {
+        const image = new Image();
+        image.src = 'http://kiwanismiracleleague.org/wp-content/themes/chillibox/media/images/404.png'
+        image.onload = () => this.setState({
+            isLoading: false
+        })
+    }
+
+    render() {
+        const { isLoading } = this.state;
+
+        return (
+            isLoading
+                ?
+                <Spinner />
+                :
+                <div className="page not-found">
+                    <img className="not-found__image" src="http://kiwanismiracleleague.org/wp-content/themes/chillibox/media/images/404.png" alt="404" />
+                    <hr className="not-found__divider" />
+                    <h1 className="not-found__message">Sorry, but looks like nobody lives here...</h1>
+                    <p><Link className="link--btn link--btn-big not-found__link--home" to={HOME}>Go home</Link></p>
+                </div>
+        )
+    }
+}

+ 43 - 0
src/components/user-components/admin-components/createDeleteUser/deleteUser/index.js

@@ -0,0 +1,43 @@
+import React from 'react';
+import { connect } from 'react-redux';
+import { Field, reduxForm } from 'redux-form';
+import { bindActionCreators } from 'redux'
+
+import formInput from '../../../../common/formInput/index';
+import {userGetRequest} from '../../../../../actions/adminActions/getUser';
+import {deleteUserRequest} from '../../../../../actions/adminActions/deleteUser'
+
+
+
+class DeleteUser extends React.Component {
+    onClick =() =>{
+        const { deleteUserRequest, data:{login}} = this.props;
+        console.log(login)
+        deleteUserRequest({
+            login
+        })
+    }
+
+    // handleClick = () => {
+    //     this.setState((prevState) => ({ clicked: !prevState.clicked }));
+    // }
+    render() {
+    const {data} =this.props
+    console.log(data)
+        return (<div>
+                    {data.login}
+                <button onClick ={this.onClick}>
+                    Delete
+                    </button>
+        </div>
+        )
+    }
+}
+
+
+
+
+const mapDispatchToProps = dispatch => bindActionCreators({ deleteUserRequest }, dispatch);
+
+
+export default connect( null,mapDispatchToProps)(DeleteUser)

+ 61 - 0
src/components/user-components/admin-components/createDeleteUser/formGetUsers/index.js

@@ -0,0 +1,61 @@
+import React from 'react';
+import { connect } from 'react-redux';
+import { Field, reduxForm } from 'redux-form';
+import { bindActionCreators } from 'redux'
+
+import formInput from '../../../../common/formInput/index';
+import {userGetRequest} from '../../../../../actions/adminActions/getUser'
+import DeleteUser from '../deleteUser/index'
+
+
+
+class FormGetUsers extends React.Component {
+    submit = ({ login}) => {
+        console.log('handleSubmit->submit', this.props)
+        const { userGetRequest }  = this.props;
+
+        console.log('hghjgjhg',login);
+
+        userGetRequest({
+            login
+        })
+    }
+
+    // handleClick = () => {
+    //     this.setState((prevState) => ({ clicked: !prevState.clicked }));
+    // }
+    render() {
+        const { handleSubmit, getUser:{data} } = this.props
+        const {submit} =this
+        console.log(data)
+        return (<div>
+            <form className="page" onSubmit = {handleSubmit(submit)}>
+                <Field name="login" type="email" placeholder="Enter new login" component={formInput} />
+                <button >Search</button>
+            </form >
+            {
+                data !== null?
+                       ( <div>
+                <DeleteUser data ={data}></DeleteUser>
+                        </div>
+                       ):
+                       <div>dddd</div>
+            }
+        </div>
+        )
+    }
+}
+
+const
+    mapStateToProps = state => ({
+        users: state.users,
+        getUser:state.getUser
+    });
+
+
+const mapDispatchToProps = dispatch => bindActionCreators({userGetRequest }, dispatch);
+
+
+export default connect(mapStateToProps, mapDispatchToProps)(reduxForm({
+    form: "FormGetUsers",
+})(FormGetUsers))

+ 36 - 12
src/components/user-components/admin-components/createDeleteUser/index.js

@@ -1,29 +1,53 @@
 import React from 'react';
 import { connect } from 'react-redux';
 import { Field, reduxForm } from 'redux-form';
+import { bindActionCreators } from 'redux'
 
 import formInput from '../../..//common/formInput';
- submit=()=>{
-     
- }
+import { usersGetRequest } from '../../../../actions/adminActions/getUsers/index'
+import FormGetUsers from './formGetUsers/index'
 
-class createDeleteUser extends React.Component {
 
+class createDeleteUser extends React.Component {
+    componentDidMount() {
+        const { usersGetRequest } = this.props;
+        usersGetRequest();
+    }
     render() {
-        const {  handleSubmit  } = this.props;
+        const { handleSubmit, users:{data} } = this.props;
+        console.log(data)
         return (
-            <form  className="page">
-                <Field name="login"  type="email" placeholder="Enter new login" component={formInput} />
-                <button >Search</button>
-            </form >
+            <div className="page page--bottom-only profile-page">
+                <section className="container section section--about">
+            <FormGetUsers></FormGetUsers>
+        </section>
+        <section className="container section section--about">
+            {data&&data.map(str=>
+            <div className="container section section--about">
+            <ul >
+                <h5>LOGIN</h5>
+                {str.login}
+                </ul>
+            <ul >
+                <h5>PASSWORD</h5>
+            {str.password}
+                </ul>
+                </div>)}
+            </section>
+        </div>
         )
     }
 }
 
+const
+    mapStateToProps = state => ({
+        users: state.users
+    });
+
 
-const mapDispatchToProps = dispatch => bindActionCreators({ userGetRequest }, dispatch);
+const mapDispatchToProps = dispatch => bindActionCreators({ usersGetRequest }, dispatch);
 
 
-export default connect(mapDispatchToProps)(reduxForm({
-    form: "createDeleteUser",   
+export default connect(mapStateToProps, mapDispatchToProps)(reduxForm({
+    form: "createDeleteUser",
 })(createDeleteUser))

+ 1 - 1
src/components/user-components/homePage/index.js

@@ -2,6 +2,6 @@ import React from 'react';
 
 export default props => (
     <div className="page">
-        There should be a home component
+        
     </div>
 )

+ 1 - 1
src/components/user-components/profilePage/LoginFild/index.js

@@ -37,7 +37,7 @@ export default class ChangeLogin extends React.Component {
                 ?
                 (
                     <React.Fragment>
-                        <div>{children}</div>
+                        <div >{children}</div>
                         <button className="link link--btn right"onClick={handleClick}>Change Email</button>
                     </React.Fragment>
                 )

+ 5 - 4
src/components/user-components/profilePage/index.js

@@ -49,9 +49,9 @@ class profilePage extends React.Component {
 
 
     render() {
-        const { user:{data}, userChangeRequest,passwordChangeRequest } = this.props;
+        const { user:{data},users, userChangeRequest,passwordChangeRequest } = this.props;
 
-        // console.log('User', user);
+        console.log('User', users);
         // console.log('Props', this.props);
         // console.log('State', this.state);
 
@@ -59,7 +59,7 @@ class profilePage extends React.Component {
             <div className="page page--bottom-only profile-page">
                 <section className="container section section--about">
                     {/* <h2 className="section__element section__element--header">{data.login}</h2> */}
-        
+
                     <div className="sedtion__element section__element--login">
                         <h3>Email</h3>
                         {/* <p>{user.login}<button className="link link--btn right" >Change login</button></p> */}
@@ -102,7 +102,8 @@ class profilePage extends React.Component {
 
 const
     mapStateToProps = state => ({
-        user: state.user
+        user: state.user,
+        users:state.users
     });
 
 const mapDispatchToProps = dispatch => bindActionCreators({ userChangeRequest, passwordChangeRequest }, dispatch);

+ 13 - 4
src/constants/index.js

@@ -1,9 +1,9 @@
-export const SIGN_IN_URL = 'http://quiz.maxcrc.de/api/v1/user?';
+export const SIGN_IN_URL = 'https://quiz.maxcrc.de/api/v1/user?';
 export const SIGN_IN_REQUEST = 'SIGN_IN_REQUEST';
 export const SIGN_IN_REQUEST_SUCCESS = 'SIGN_IN_REQUEST_SUCCESS';
 export const SIGN_IN_REQUEST_FAILURE = 'SIGN_IN_REQUEST_FAILURE';
 
-export const SIGN_UP_URL = 'http://quiz.maxcrc.de/api/v1/user';
+export const SIGN_UP_URL = 'https://quiz.maxcrc.de/api/v1/user';
 export const SIGN_UP_REQUEST = 'SIGN_UP_REQUEST';
 export const SIGN_UP_REQUEST_SUCCESS = 'SIGN_UP_REQUEST_SUCCESS';
 export const SIGN_UP_REQUEST_FAILURE = 'SIGN_UP_REQUEST_FAILURE';
@@ -15,11 +15,11 @@ export const SIGN_OUT = 'SIGN_OUT';
 
 export const USERS_GET_REQUEST = 'USERS_GET_REQUEST';
 export const USERS_GET_REQUEST_SUCCESS = 'USERS_GET_REQUEST_SUCCESS';
-export const USERS_GET_REQUEST_SUCCESS_FAILURE = 'USERS_GET_REQUEST_FAILURE';
+export const USERS_GET_REQUEST_FAILURE = 'USERS_GET_REQUEST_FAILURE';
 
 export const TOKEN_AUTH = 'TOKEN_AUTH';
 
-export const USERS_CHANGE_URL = 'http://quiz.maxcrc.de/api/v1/user/';
+export const USERS_CHANGE_URL = 'https://quiz.maxcrc.de/api/v1/user/';
 export const USERS_CHANGE_REQUEST = 'USERS_CHANGE_REQUEST';
 export const USERS_CHANGE_REQUEST_SUCCESS = 'USERS_CHANGE_REQUEST_SUCCESS';
 export const USERS_CHANGE_REQUEST_FAILURE = 'USERS_CHANGE_REQUEST_FAILURE';
@@ -33,3 +33,12 @@ export const GET_CARDS_URL = 'https://quiz.maxcrc.de/api/v1/quiz';
 export const GET_CARDS = 'GET_CARD';
 export const GET_CARDS_SUCCESS = 'GET_CARDS_SUCCESS';
 export const GET_CARDS_FAILURE = 'GET_CARDS_FAILURE';
+
+export const USER_GET ='https://quiz.maxcrc.de/api/v1/user?'
+export const USER_GET_REQUEST = 'USER_GET_REQUEST';
+export const USER_GET_REQUEST_SUCCESS = 'USER_GET_REQUEST_SUCCESS';
+export const USER_GET_REQUEST_FAILURE = 'USER_GET_REQUEST_FAILURE';
+
+export const DELETE_USER_REQUEST = 'DELETE_USER_REQUEST';
+export const DELETE_USER_REQUEST_SUCCESS = 'DELETE_USER_REQUEST_SUCCESS';
+export const DELETE_USER_REQUEST_FAILURE = 'DELETE_USER_REQUEST_FAILURE';

+ 30 - 0
src/reducers/getUser/index.js

@@ -0,0 +1,30 @@
+import * as types from "../../constants/index";
+import initialState from '../initialState';
+
+export default function getUser(state = initialState.getUser, {type, payload: data, error }) {
+    switch (type) {
+        case types.USER_GET_REQUEST: {
+            return {
+                ...state,
+                isFetching: true
+            }
+        }
+        case types.USER_GET_REQUEST_SUCCESS: {
+            return {
+                ...state,
+                isFetching: false,
+                data
+            }
+        }
+        case types.USER_GET_REQUEST_FAILURE: {
+            return {
+                ...state,
+                isFetching: false,
+                error
+            }
+        }
+        default: {
+            return state
+        }
+    }
+}

+ 5 - 1
src/reducers/index.js

@@ -6,6 +6,8 @@ import user from './user';
 import changeEmail from './userFields/changeEmail/index';
 import changePassword from './userFields/changePassword/index'
 import cards from './cards';
+import users from './users'
+import getUser from './getUser'
 
 import { reducer as form } from 'redux-form';
 
@@ -16,7 +18,9 @@ const combinedReducers = combineReducers({
     user,
     changeEmail,
     changePassword,
-    cards
+    cards,
+    users,
+    getUser
 })
 
 export default combinedReducers;

+ 10 - 0
src/reducers/initialState/index.js

@@ -14,5 +14,15 @@ export default {
         data: null,
         error: null,
         isFetching: null
+    },
+    users: {
+        data: null,
+        error: null,
+        isFetching: null
+    },
+    getUser:{
+        data:null,
+        error: null,
+        isFetching: null
     }
 }

+ 30 - 0
src/reducers/users/index.js

@@ -0,0 +1,30 @@
+import * as types from "../../constants/index";
+import initialState from '../initialState';
+
+export default function getUsers(state = initialState.users, {type, payload: data, error }) {
+    switch (type) {
+        case types.USERS_GET_REQUEST: {
+            return {
+                ...state,
+                isFetching: true
+            }
+        }
+        case types.USERS_GET_REQUEST_SUCCESS: {
+            return {
+                ...state,
+                isFetching: false,
+                data
+            }
+        }
+        case types.USERS_GET_REQUEST_FAILURE: {
+            return {
+                ...state,
+                isFetching: false,
+                error
+            }
+        }
+        default: {
+            return state
+        }
+    }
+}

+ 1 - 2
src/saga/auth/index.js

@@ -3,12 +3,11 @@ import * as types from "./../../constants"
 
 import signIn from './signIn';
 import signUp from './signUp';
-import getUsers from './users/users';
+
 
 export default function*() {
     yield takeEvery(types.SIGN_IN_REQUEST, signIn);
     yield takeEvery(types.SIGN_UP_REQUEST, signUp);
-    yield takeEvery(types.USERS_GET_REQUEST, getUsers);
 }
 
 

+ 0 - 19
src/saga/auth/users/users.js

@@ -1,19 +0,0 @@
-import { put, call } from "redux-saga/effects";
-import * as actions from './../../../actions/auth/users/users'
-import axios from 'axios';
-
-
-
-export default function* ({ payload: requestBody }) {
-    try {
-        const payload = yield call(() =>
-            axios.get(`https://quiz.maxcrc.de/api/v1/user`)
-                .then(({ data }) => data)
-        );
-        
-        yield put(actions.usersGetRequestSucces(payload));
-    }
-    catch ({ message }) {
-        yield put(actions.usersGetRequestFailure(message))
-    }
-}

+ 18 - 0
src/saga/userFields/deleteUser/index.js

@@ -0,0 +1,18 @@
+import { put, call } from "redux-saga/effects";
+import * as actions from './../../../actions/adminActions/deleteUser'
+import axios from 'axios';
+import { USER_GET } from '../../../constants/index'
+
+export default function* ({payload:{login}}) {
+    try {
+        console.log("payload inside the saga", login);
+        const payloads = yield call(() =>
+            axios.delete(`${USER_GET}login=${login}`)
+                .then((data) => data)
+        );
+        yield put(actions.deleteUserRequestSucces(payloads));
+    }
+    catch ({ message }) {
+        yield put(actions.deleteUserRequestFailure(message))
+    }
+}

+ 18 - 0
src/saga/userFields/getUser/index.js

@@ -0,0 +1,18 @@
+import { put, call } from "redux-saga/effects";
+import * as actions from '../../../actions/adminActions/getUser/index'
+import axios from 'axios';
+import { USER_GET } from '../../../constants/index'
+
+export default function* ({payload:{login}}) {
+    try {
+        console.log("payload inside the saga",login);
+        const payloads = yield call(() =>
+            axios.get(`${USER_GET}login=${login}`)
+                .then(({data: [payload]}) => payload)
+        );
+        yield put(actions.userGetRequestSucces(payloads));
+    }
+    catch ({ message }) {
+        yield put(actions.userGetRequestFailure(message))
+    }
+}

+ 4 - 4
src/saga/userFields/createDeleteUser/index.js

@@ -1,5 +1,5 @@
 import { put, call } from "redux-saga/effects";
-import * as actions from './../../../actions/adminActions/index'
+import * as actions from '../../../actions/adminActions/getUsers/index'
 import axios from 'axios';
 import { SIGN_UP_URL } from '../../../constants/index'
 
@@ -8,11 +8,11 @@ export default function* (payload) {
         console.log("payload inside the saga", payload);
         const payloads = yield call(() =>
             axios.get(SIGN_UP_URL)
-                .then(({ data }) => data)
+                .then(({data}) => data)
         );
-        yield put(actions.userGetRequestSucces(payloads));
+        yield put(actions.usersGetRequestSucces(payloads));
     }
     catch ({ message }) {
-        yield put(actions.userGetRequestFailure(message))
+        yield put(actions.usersGetRequestFailure(message))
     }
 }

+ 7 - 2
src/saga/userFields/index.js

@@ -3,9 +3,14 @@ import * as types from "./../../constants"
 
 import changeEmail from './changeEmail/index';
 import changePassword from "./changePassword";
-
+import getUsers from './getUsers'
+import getUser from './getUser'
+import deleteUser from './deleteUser'
 
 export default function*() {
     yield takeEvery(types.USERS_CHANGE_REQUEST, changeEmail);
-    yield takeEvery(types.PASSWORD_CHANGE_REQUEST, changePassword)
+    yield takeEvery(types.PASSWORD_CHANGE_REQUEST, changePassword);
+    yield takeEvery(types.USERS_GET_REQUEST, getUsers);
+    yield takeEvery(types.USER_GET_REQUEST, getUser);
+    yield takeEvery(types.DELETE_USER_REQUEST, deleteUser);
 }

+ 1 - 1
src/state/index.js

@@ -14,7 +14,7 @@ const logger = createLogger({
 const store = createStore(
     combinedReducers,
     initialState,
-    applyMiddleware(sagaMiddleware)
+    applyMiddleware(sagaMiddleware, logger)
 );
 export default store;
 

+ 1 - 1
src/styles/base/_base.scss

@@ -35,7 +35,7 @@ code {
 // recheck
 
 @media screen and (max-width: 1200px) {
-    * {
+    *:not(nav) {
         transition: none !important;
     }
 }

+ 6 - 1
src/styles/components/_header.scss

@@ -36,6 +36,10 @@
             display: flex;
             margin-bottom: 25px;
 
+            .header-nav {
+                
+            }
+
             li {
                 a {
                     color: $color-white;
@@ -104,7 +108,8 @@
                 bottom: 7px;
             }
         }
-        .toggle-status {
+
+        .nav-toggle-status {
             &--closed {
                 transform: scale(1, 0);
             }

+ 4 - 0
src/styles/components/_profilePage.scss

@@ -8,6 +8,10 @@
         flex-basis: 400px;
         margin: 10px;
         padding: 10px;
+
+        h3{
+            margin: 25px 0
+        }
         &__element {
             &--image {
                 border: 3px solid $color-lightsteelblue;

+ 1 - 1
src/styles/components/_signPage.scss

@@ -22,7 +22,7 @@
             margin: 0 0 35px 0;
         }
         &__password-container {
-            margin: 50px 0;
+            margin: 50px 0 20px 0;
         }
         &__input {
             display: block;