Browse Source

Réglage PUT et DELETE + Photos

Kongzibapt 3 years ago
parent
commit
fb2673ffc8

+ 7
- 7
api_proximo/composer.lock View File

@@ -478,22 +478,22 @@
478 478
         },
479 479
         {
480 480
             "name": "fruitcake/laravel-cors",
481
-            "version": "v2.0.2",
481
+            "version": "v2.0.3",
482 482
             "source": {
483 483
                 "type": "git",
484 484
                 "url": "https://github.com/fruitcake/laravel-cors.git",
485
-                "reference": "4b19bfc3bd422948af37a42a62fad7f49025894a"
485
+                "reference": "01de0fe5f71c70d1930ee9a80385f9cc28e0f63a"
486 486
             },
487 487
             "dist": {
488 488
                 "type": "zip",
489
-                "url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/4b19bfc3bd422948af37a42a62fad7f49025894a",
490
-                "reference": "4b19bfc3bd422948af37a42a62fad7f49025894a",
489
+                "url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/01de0fe5f71c70d1930ee9a80385f9cc28e0f63a",
490
+                "reference": "01de0fe5f71c70d1930ee9a80385f9cc28e0f63a",
491 491
                 "shasum": ""
492 492
             },
493 493
             "require": {
494 494
                 "asm89/stack-cors": "^2.0.1",
495
-                "illuminate/contracts": "^6|^7|^8",
496
-                "illuminate/support": "^6|^7|^8",
495
+                "illuminate/contracts": "^6|^7|^8|^9",
496
+                "illuminate/support": "^6|^7|^8|^9",
497 497
                 "php": ">=7.2",
498 498
                 "symfony/http-foundation": "^4|^5",
499 499
                 "symfony/http-kernel": "^4.3.4|^5"
@@ -547,7 +547,7 @@
547 547
                     "type": "github"
548 548
                 }
549 549
             ],
550
-            "time": "2020-09-07T11:48:52+00:00"
550
+            "time": "2020-10-22T13:57:20+00:00"
551 551
         },
552 552
         {
553 553
             "name": "graham-campbell/result-type",

+ 2
- 2
api_proximo/config/cors.php View File

@@ -17,9 +17,9 @@ return [
17 17
 
18 18
     'paths' => ['api/*'],
19 19
 
20
-    'allowed_methods' => ['*'],
20
+    'allowed_methods' => ['POST', 'GET', 'DELETE', 'PUT', '*'],
21 21
 
22
-    'allowed_origins' => ['*'],
22
+    'allowed_origins' => ['http://localhost:3000', 'https://etud.insa-toulouse.fr/~proximo/v2','*'],
23 23
 
24 24
     'allowed_origins_patterns' => [],
25 25
 

+ 2
- 2
src/js/Components/ArticleDetails.js View File

@@ -111,14 +111,14 @@ class ArticleDetails extends React.Component {
111 111
                 </div>
112 112
             </div>
113 113
             <div id="categoryDiv">
114
-                <img onClick={() => this.props.handleCategories(this.props.category)} id="categoryIcon" alt="bonjour" src={`https://etud.insa-toulouse.fr/~proximo/v2/storage/icon/${this.props.category.icon}`}/>
114
+                <img onClick={() => this.props.handleCategories(this.props.category)} id="categoryIcon" alt="bonjour" src={`https://etud.insa-toulouse.fr/~proximo/api_proximo/storage/app/public/icon/${this.props.category.icon}`}/>
115 115
             </div>
116 116
             <div id="descandprice">
117 117
                 <h1 id="desc">{this.props.desc}</h1>
118 118
                 <p id ="price">{this.props.price} €</p>
119 119
             </div>
120 120
             </>
121
-            : <img id="image" src={`https://etud.insa-toulouse.fr/~proximo/v2/storage/img/${this.props.img}`} alt='bonjour'/>
121
+            : <img id="image" src={`https://etud.insa-toulouse.fr/~proximo/api_proximo/storage/app/public/img/${this.props.img}`} alt='bonjour'/>
122 122
             }
123 123
             </div>
124 124
                     <h1 id="name">{this.props.name}</h1>

+ 3
- 2
src/js/Components/EditArticle.js View File

@@ -96,10 +96,11 @@ class EditArticle extends React.Component {
96 96
                 this.setState({errors : []})
97 97
             })
98 98
             .catch(error => {
99
+                
99 100
                 if(error.response.status === 401){
100 101
                     this.setState({errors : error.response.data.errors})
101 102
                 }
102
-                console.log(error.response.data.errors)
103
+                
103 104
             });
104 105
         }
105 106
 
@@ -111,10 +112,10 @@ class EditArticle extends React.Component {
111 112
                 this.props.handleCloseAbove();
112 113
             })
113 114
             .catch(error => {
115
+                console.log(error)
114 116
                 if(error.response.status === 401){
115 117
                     this.setState({errors : error.response.data.errors})
116 118
                 }
117
-                console.log(error.response.data.errors)
118 119
             });
119 120
     }
120 121
 

+ 1
- 1
src/js/Views/Stock.js View File

@@ -45,7 +45,7 @@ export default class Stock extends React.Component {
45 45
     axios.post('https://etud.insa-toulouse.fr/~proximo/v2/api/articles/sort',bodyFormData)
46 46
         .then(res => {
47 47
             this.setState({articles : res.data}, () => {
48
-                console.log(this.state)
48
+                console.log(this.state.articles)
49 49
             })
50 50
         })
51 51
         .catch(error => {

Loading…
Cancel
Save