Réglage PUT et DELETE + Photos

This commit is contained in:
Kongzibapt 2021-01-27 17:35:25 +01:00
parent e39f423787
commit fb2673ffc8
5 changed files with 15 additions and 14 deletions

View file

@ -478,22 +478,22 @@
}, },
{ {
"name": "fruitcake/laravel-cors", "name": "fruitcake/laravel-cors",
"version": "v2.0.2", "version": "v2.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/fruitcake/laravel-cors.git", "url": "https://github.com/fruitcake/laravel-cors.git",
"reference": "4b19bfc3bd422948af37a42a62fad7f49025894a" "reference": "01de0fe5f71c70d1930ee9a80385f9cc28e0f63a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/4b19bfc3bd422948af37a42a62fad7f49025894a", "url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/01de0fe5f71c70d1930ee9a80385f9cc28e0f63a",
"reference": "4b19bfc3bd422948af37a42a62fad7f49025894a", "reference": "01de0fe5f71c70d1930ee9a80385f9cc28e0f63a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"asm89/stack-cors": "^2.0.1", "asm89/stack-cors": "^2.0.1",
"illuminate/contracts": "^6|^7|^8", "illuminate/contracts": "^6|^7|^8|^9",
"illuminate/support": "^6|^7|^8", "illuminate/support": "^6|^7|^8|^9",
"php": ">=7.2", "php": ">=7.2",
"symfony/http-foundation": "^4|^5", "symfony/http-foundation": "^4|^5",
"symfony/http-kernel": "^4.3.4|^5" "symfony/http-kernel": "^4.3.4|^5"
@ -547,7 +547,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-09-07T11:48:52+00:00" "time": "2020-10-22T13:57:20+00:00"
}, },
{ {
"name": "graham-campbell/result-type", "name": "graham-campbell/result-type",

View file

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

View file

@ -111,14 +111,14 @@ class ArticleDetails extends React.Component {
</div> </div>
</div> </div>
<div id="categoryDiv"> <div id="categoryDiv">
<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}`}/> <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}`}/>
</div> </div>
<div id="descandprice"> <div id="descandprice">
<h1 id="desc">{this.props.desc}</h1> <h1 id="desc">{this.props.desc}</h1>
<p id ="price">{this.props.price} </p> <p id ="price">{this.props.price} </p>
</div> </div>
</> </>
: <img id="image" src={`https://etud.insa-toulouse.fr/~proximo/v2/storage/img/${this.props.img}`} alt='bonjour'/> : <img id="image" src={`https://etud.insa-toulouse.fr/~proximo/api_proximo/storage/app/public/img/${this.props.img}`} alt='bonjour'/>
} }
</div> </div>
<h1 id="name">{this.props.name}</h1> <h1 id="name">{this.props.name}</h1>

View file

@ -96,10 +96,11 @@ class EditArticle extends React.Component {
this.setState({errors : []}) this.setState({errors : []})
}) })
.catch(error => { .catch(error => {
if(error.response.status === 401){ if(error.response.status === 401){
this.setState({errors : error.response.data.errors}) this.setState({errors : error.response.data.errors})
} }
console.log(error.response.data.errors)
}); });
} }
@ -111,10 +112,10 @@ class EditArticle extends React.Component {
this.props.handleCloseAbove(); this.props.handleCloseAbove();
}) })
.catch(error => { .catch(error => {
console.log(error)
if(error.response.status === 401){ if(error.response.status === 401){
this.setState({errors : error.response.data.errors}) this.setState({errors : error.response.data.errors})
} }
console.log(error.response.data.errors)
}); });
} }

View file

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