Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Multiselect from "vue-multiselect";
- import __ from 'lodash';
- export default {
- name: 'resume-update',
- props: ['resume'],
- components: {
- Multiselect
- },
- data: () => ({
- form: {
- name: '',
- level: '',
- salary: '',
- experience: '',
- education: [],
- employment: []
- },
- submitted: {
- form: false,
- destroy: false,
- restore: false
- },
- errors: []
- }),
- methods: {
- update(e) {
- this.submitted.form = true;
- axios.put(e.target.action, this.form).then(response => {
- this.resume = response.data.data
- this.submitted.form = false;
- }).catch(error => {
- if (error.response) {
- this.errors = error.response.data.errors;
- }
- this.submitted.form = false;
- });
- },
- destroy() {
- this.submitted.destroy = true;
- axios.delete(this.resume.routes.destroy).then(response => {
- this.resume = response.data.data;
- this.submitted.destroy = false;
- }).catch(error => {
- this.submitted.destroy = false;
- })
- },
- restore() {
- this.submitted.restore = true;
- axios.post(this.resume.routes.restore).then(response => {
- this.resume = response.data.data;
- this.submitted.restore = false;
- }).catch(error => {
- this.submitted.restore = false;
- })
- },
- reset() {
- for (const prop of Object.getOwnPropertyNames(this.form)) {
- delete this.form[prop];
- }
- }
- },
- watch: {
- resume: function() {
- this.form = this.resume;
- },
- },
- created() {
- this.form = __.cloneDeep(this.resume);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment