vit9 il y a 5 ans
Parent
commit
85360c3f97
3 fichiers modifiés avec 22 ajouts et 60 suppressions
  1. 0 47
      src/back.js
  2. 19 1
      src/components/Auth/registration.js
  3. 3 12
      src/container/App.js

+ 0 - 47
src/back.js

@@ -1,47 +0,0 @@
-export default [
-    {
-        category: "Одежда",
-        podCategory: [
-            {
-            name: "Женская одежда",
-            clothes: [
-                {   
-                    type: "Нижнее белье",
-                    Underwear: [
-                        {
-                            name: "Носки",
-                            price: 45,
-                            state: true,
-                            description: "очень хрошоие носки",
-                            img: "https://gift2u.com.ua/image/cache/data/PRODUCTS/003-socks/new-winter-2017/007-01-800x800.jpg"
-                        },
-                        {
-                            name: "Носки",
-                            price: 45,
-                            state: true,
-                            description: "очень хрошоие носки",
-                            img: "https://gift2u.com.ua/image/cache/data/PRODUCTS/003-socks/Happy-Socks/003-014-800x800.jpg"
-                        },
-                        {
-                            name: "Носки",
-                            price: 45,
-                            state: true,
-                            description: "очень хрошоие носки",
-                            img: "https://i1.rozetka.ua/goods/2258281/24258087_images_2258281935.jpg"
-                        }
-                    ],
-
-                }
-            ]
-            },
-            {
-                
-            }
-        ]
-    },
-    {
-        category: "Электроника",
-                        
-    }
-];
-

+ 19 - 1
src/components/Auth/registration.js

@@ -1,10 +1,28 @@
 import React from 'react'
 import { Field, reduxForm } from 'redux-form'
 
+const axios = require('axios');
+const submit = values => {
+   axios.post(`http://127.0.0.1:2000/api/users`,{
+        "name": values.Name,
+        "description": "dfgfdhd",
+        "login": "Johny",
+        "password": values.Login,
+        "isAdmin": "0",
+        "email": values.email,
+        "avatar": "https://git-scm.com/book/ru/v1/",
+        "phone": values.Phone  
+})
+  .then(function (response) {
+    // handle success
+    console.log(response);
+  })
+  .catch((err)=>console.log(err))
+};
 const RegistrForm = props => {
   const { handleSubmit, pristine, reset, submitting } = props
   return (
-    <form onSubmit={handleSubmit}>
+    <form onSubmit={handleSubmit(submit)}>
       <div>
         <label>Login</label>
         <div>

+ 3 - 12
src/container/App.js

@@ -1,25 +1,16 @@
 import React, { Component } from 'react';
 
-import Back from '../back'
+
 import LeftMenu from '../components/LeftMenu'
 
 class App extends Component {
   render() {
-    console.log(Back)
     return (
       <div className='ras'>
           <div className='ras1'>
-            <LeftMenu />
-           
-          </div>
-          <div className='ras2'>
-                {
-                  
-                  Back[0].podCategory[0].clothes[0].Underwear.map(el=><div className='as'><img className="img" src={el.img} alt='sadasd' /><p>{el.name}</p><p>{el.price}</p></div>)   
-                }
+            <LeftMenu /> 
           </div>
-      </div>
-      
+      </div>       
     );
   }
 }