Skip to content

Commit

Permalink
Merge pull request #21 from nim1821/master
Browse files Browse the repository at this point in the history
Added Axios call for AddProduct
  • Loading branch information
nim1821 committed Feb 4, 2019
2 parents 1909ebb + 906d1af commit 554d5c5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions frontend/src/views/AddProduct.vue
Expand Up @@ -37,6 +37,8 @@
</template>

<script>
import Axios from 'axios'
import qs from 'qs'
export default {
components:{
Expand All @@ -56,18 +58,21 @@ export default {
post: function(){
this.$validator.validateAll().then(valid => {
if (valid) {
this.$http.post(
Axios.post(
'https://localhost:8765/observatory/api/products',
{
qs.stringify({
name: this.product.name,
description: this.product.description,
category: this.product.category,
tags: this.product.tags.map(function(tag) {
return tag['text']; }),
},{arrayFormat :'repeat'}),
{headers: {
'X-OBSERVATORY-AUTH': this.$store.getters.token,
'Content-Type': 'application/x-www-form-urlencoded'
},
{headers: {'X-OBSERVATORY-AUTH': this.$store.getters.token},
emulateJSON: true}
).then(function(){
).then(()=>{
alert("Ευχαριστούμε για την προσθήκη ενός νέου προϊόντος!");
this.doReset();
return;
Expand Down

0 comments on commit 554d5c5

Please sign in to comment.