parasails.registerPage('edit-faq', {
  //  ╦╔╗╔╦╔╦╗╦╔═╗╦    ╔═╗╔╦╗╔═╗╔╦╗╔═╗
  //  ║║║║║ ║ ║╠═╣║    ╚═╗ ║ ╠═╣ ║ ║╣
  //  ╩╝╚╝╩ ╩ ╩╩ ╩╩═╝  ╚═╝ ╩ ╩ ╩ ╩ ╚═╝
  data: {
    message: { severity: '', summary: '', details: ''}
  },

  //  ╦  ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦  ╔═╗
  //  ║  ║╠╣ ║╣ ║  ╚╦╝║  ║  ║╣
  //  ╩═╝╩╚  ╚═╝╚═╝ ╩ ╚═╝╩═╝╚═╝
  beforeMount: function() {
    //…
  },
  mounted: async function() {
    //…
  },

  //  ╦╔╗╔╔╦╗╔═╗╦═╗╔═╗╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
  //  ║║║║ ║ ║╣ ╠╦╝╠═╣║   ║ ║║ ║║║║╚═╗
  //  ╩╝╚╝ ╩ ╚═╝╩╚═╩ ╩╚═╝ ╩ ╩╚═╝╝╚╝╚═╝
  methods: {
    save: function (faq) {
      Cloud.saveFaq.with({
        id: faq.id | undefined,
        question: faq.question,
        answer: faq.answer,
        lang: faq.lang
      })
        .then(result=>{
          this.message = {severity: 'success', summary: 'Success on Saving', details: ''}
        })
        .catch(err=>{
          console.log(err.message)
          this.message = {severity: 'error', summary: 'Error on Saving', details: ''}

        })
    },
    gotoback: function () {
      this.goto('/search-faq')

    },
    cleanMessage: function () {
      this.message = {}
      this.goto('/search-faq')
    }
  }
});
