Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default {
- name: "Contact",
- components: {
- FooterComponent: FooterComponent,
- NavigationComponent: NavigationComponent
- },
- data() {
- return {
- locale: Cookie.get('locale'),
- nameAndLastName: '',
- email: '',
- subject: '',
- message: '',
- showPopUp: false
- }
- },
- methods: {
- sendEmail(e) {
- e.preventDefault();
- this.$validator.validateAll();
- if (!this.$validator.errors.any()) {
- let params = new URLSearchParams();
- params.append('nameAndLastName', this.nameAndLastName);
- params.append('email', this.email);
- params.append('subject', this.subject);
- params.append('message', this.message);
- axios.post(this.$apiUrl + `rest/api/public/Contact/contact`, params, {
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- }
- })
- .then(function (response) {
- if (response.statusText === 'OK') {
- console.log(this.showPopUp);
- this.showPopUp = true;
- }
- })
- .catch(function (error) {
- console.log(error);
- // This throws error TypeError: Cannot read property 'showPopUp' of undefined
- });
- }
- }
- },
- mounted: function () {
- console.log('test');
- console.log(this.showPopUp);
- },
- }
Add Comment
Please, Sign In to add comment