2018-11-08 01:09:33 +01:00
|
|
|
import Vue from 'vue'
|
2018-11-17 20:32:28 +01:00
|
|
|
import { Component } from 'vue-property-decorator'
|
|
|
|
|
import { GlobalStore } from '@store'
|
2018-11-08 01:09:33 +01:00
|
|
|
|
|
|
|
|
require('./home.scss')
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
export default class Home extends Vue {
|
|
|
|
|
text: string = ''
|
|
|
|
|
visibile: boolean = false
|
|
|
|
|
cardvisible: string = 'hidden'
|
|
|
|
|
displaycard: string = 'block'
|
|
|
|
|
|
2018-11-11 19:27:04 +01:00
|
|
|
public $q
|
|
|
|
|
|
2018-11-08 01:09:33 +01:00
|
|
|
constructor() {
|
|
|
|
|
super()
|
|
|
|
|
console.log('created...')
|
|
|
|
|
this.initprompt()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mystilecard() {
|
|
|
|
|
return {
|
|
|
|
|
visibility: this.cardvisible,
|
|
|
|
|
display: this.displaycard
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get conta() {
|
2018-11-26 00:53:05 +01:00
|
|
|
return GlobalStore.state.conta
|
2018-11-08 01:09:33 +01:00
|
|
|
}
|
|
|
|
|
set conta(valore) {
|
2018-11-17 20:32:28 +01:00
|
|
|
GlobalStore.actions.setConta(valore)
|
|
|
|
|
let my = this.$q.i18n.lang
|
2018-11-08 01:09:33 +01:00
|
|
|
this.showNotification(String(my))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showNotification(msg: string) {
|
|
|
|
|
this.$q.notify(msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initprompt() {
|
|
|
|
|
window.addEventListener('beforeinstallprompt', function (event) {
|
|
|
|
|
console.log('******************************** beforeinstallprompt fired')
|
|
|
|
|
event.preventDefault()
|
|
|
|
|
console.log('§§§§§§§§§§§§§§§§§§§§ IMPOSTA DEFERRED PROMPT !!!!!!!!!!!!!!!!! ')
|
|
|
|
|
return false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test_fetch() {
|
|
|
|
|
fetch('https:/httpbin.org/post', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
'Accept': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
// mode: 'no-cors',
|
|
|
|
|
mode: 'cors',
|
|
|
|
|
body: JSON.stringify({ message: 'Does this work?' })
|
|
|
|
|
}).then(function (response) {
|
|
|
|
|
console.log(response)
|
|
|
|
|
if (response)
|
|
|
|
|
return response.json()
|
|
|
|
|
else
|
|
|
|
|
return null
|
|
|
|
|
}).then(function (data) {
|
|
|
|
|
console.log(data)
|
|
|
|
|
}).catch(function (err) {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openCreatePostModal() {
|
|
|
|
|
console.log('APERTO ! openCreatePostModal')
|
|
|
|
|
|
|
|
|
|
this.conta = this.conta + 1
|
|
|
|
|
|
|
|
|
|
this.visibile = !this.visibile
|
|
|
|
|
|
|
|
|
|
if (this.visibile) {
|
|
|
|
|
this.displaycard = 'block'
|
|
|
|
|
this.cardvisible = 'visible'
|
|
|
|
|
} else {
|
|
|
|
|
this.displaycard = 'block'
|
|
|
|
|
this.cardvisible = 'hidden'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|