diff --git a/backend/main.go b/backend/main.go index 6b58842..2a5107d 100644 --- a/backend/main.go +++ b/backend/main.go @@ -1,5 +1,8 @@ package main +//Uruchomienie na windowsie +// go run main.go connector_couchdb.go connector_mysql.go models.go views.go + import ( "net/http" diff --git a/frontend/app/src/components/Popup.vue b/frontend/app/src/components/Popup.vue index 1e3bd6f..e3caf7c 100644 --- a/frontend/app/src/components/Popup.vue +++ b/frontend/app/src/components/Popup.vue @@ -48,12 +48,49 @@ export default { }, methods:{ submit(){ + //pobiera dane i wysyla na backend jsona dla karty + /*{ "id" : 1, + "IsQuestion" : true , + "Blank" :1 , + "texst": "ALA MA KOTA" + }*/ + if (this.$refs.form.validate()){ //valinnaj JS // this.loading = true; console.log("Dodanie do bazy") + console.log(this.cardText) + console.log(this.cardType) + var blank = 0 + if (this.cardText.match(/_/g)){ + blank = this.cardText.match(/_/g).length; + } + if (this.cardType === "pytanie" && blank === 0){ + //walidacja - karta pytanie musi miec min 1 pole puste + this.inputRules = [false || 'Karta pytanie musi miec min jedno pole na odpwiedz ( znak podłogi _)'] //info zwrotne w dialogu dla uzytkownika + } + + var cardObj = {} + if (this.cardType == "pytanie"){ + cardObj.isQuestion = true + }else{ + cardObj.isQuestion = false + } + cardObj.blank = blank + cardObj.text = this.cardText + + + axios.get(url_status, { + headers: { + 'Content-Type': 'application/json', + } + } + ).then(function(response){ + vm.friendlist = response.data; + }) + .catch(function(error){ + vm.friendlist = "An error occured: " + error; + }); this.$emit('cardAdded') - - } } }, diff --git a/frontend/app/src/views/Game.vue b/frontend/app/src/views/Game.vue index 3a2e0ad..63286b0 100644 --- a/frontend/app/src/views/Game.vue +++ b/frontend/app/src/views/Game.vue @@ -46,7 +46,9 @@