Automatically convert routes to strings

This commit is contained in:
Jonathan Reinink 2019-04-15 19:38:57 -04:00
parent 87b77f794c
commit f357317f46
11 changed files with 21 additions and 21 deletions

View File

@ -54,7 +54,7 @@ export default {
methods: {
submit() {
this.sending = true
Inertia.post(this.route('login.attempt').url(), {
Inertia.post(this.route('login.attempt'), {
email: this.form.email,
password: this.form.password,
remember: this.form.remember,

View File

@ -71,7 +71,7 @@ export default {
methods: {
submit() {
this.form.post({
url: this.route('contacts.store').url(),
url: this.route('contacts.store'),
then: data => Inertia.visit(this.route('contacts.edit', data.id)),
})
},

View File

@ -79,23 +79,23 @@ export default {
methods: {
submit() {
this.form.put({
url: this.route('contacts.update', this.contact.id).url(),
url: this.route('contacts.update', this.contact.id),
then: () => Inertia.visit(this.route('contacts')),
})
},
destroy() {
if (confirm('Are you sure you want to delete this contact?')) {
this.form.delete({
url: this.route('contacts.destroy', this.contact.id).url(),
then: () => Inertia.replace(this.route('contacts.edit', this.contact.id).url()),
url: this.route('contacts.destroy', this.contact.id),
then: () => Inertia.replace(this.route('contacts.edit', this.contact.id)),
})
}
},
restore() {
if (confirm('Are you sure you want to restore this contact?')) {
this.form.put({
url: this.route('contacts.restore', this.contact.id).url(),
then: () => Inertia.replace(this.route('contacts.edit', this.contact.id).url()),
url: this.route('contacts.restore', this.contact.id),
then: () => Inertia.replace(this.route('contacts.edit', this.contact.id)),
})
}
},

View File

@ -94,7 +94,7 @@ export default {
form: {
handler: _.throttle(function() {
let query = _.pickBy(this.form)
Inertia.replace(this.route('contacts', Object.keys(query).length ? query : { remember: 'forget' }).url())
Inertia.replace(this.route('contacts', Object.keys(query).length ? query : { remember: 'forget' }))
}, 150),
deep: true,
},

View File

@ -77,7 +77,7 @@ export default {
methods: {
submit() {
this.sending = true
Inertia.post(this.route('organizations.store').url(), this.form).then(() => this.sending = false)
Inertia.post(this.route('organizations.store'), this.form).then(() => this.sending = false)
},
},
}

View File

@ -111,16 +111,16 @@ export default {
},
methods: {
submit() {
Inertia.put(this.route('organizations.update', this.organization.id).url(), this.form)
Inertia.put(this.route('organizations.update', this.organization.id), this.form)
},
destroy() {
if (confirm('Are you sure you want to delete this organization?')) {
Inertia.delete(this.route('organizations.destroy', this.organization.id).url())
Inertia.delete(this.route('organizations.destroy', this.organization.id))
}
},
restore() {
if (confirm('Are you sure you want to restore this organization?')) {
Inertia.put(this.route('organizations.restore', this.organization.id).url())
Inertia.put(this.route('organizations.restore', this.organization.id))
}
},
},

View File

@ -86,7 +86,7 @@ export default {
form: {
handler: _.throttle(function() {
let query = _.pickBy(this.form)
Inertia.replace(this.route('organizations', Object.keys(query).length ? query : { remember: 'forget' }).url())
Inertia.replace(this.route('organizations', Object.keys(query).length ? query : { remember: 'forget' }))
}, 150),
deep: true,
},

View File

@ -57,7 +57,7 @@ export default {
methods: {
submit() {
this.form.post({
url: this.route('users.store').url(),
url: this.route('users.store'),
then: data => Inertia.visit(this.route('users.edit', data.id)),
})
},

View File

@ -65,23 +65,23 @@ export default {
methods: {
submit() {
this.form.put({
url: this.route('users.update', this.user.id).url(),
url: this.route('users.update', this.user.id),
then: () => Inertia.visit(this.route('users')),
})
},
destroy() {
if (confirm('Are you sure you want to delete this user?')) {
this.form.delete({
url: this.route('users.destroy', this.user.id).url(),
then: () => Inertia.replace(this.route('users.edit', this.user.id).url()),
url: this.route('users.destroy', this.user.id),
then: () => Inertia.replace(this.route('users.edit', this.user.id)),
})
}
},
restore() {
if (confirm('Are you sure you want to restore this user?')) {
this.form.put({
url: this.route('users.restore', this.user.id).url(),
then: () => Inertia.replace(this.route('users.edit', this.user.id).url()),
url: this.route('users.restore', this.user.id),
then: () => Inertia.replace(this.route('users.edit', this.user.id)),
})
}
},

View File

@ -90,7 +90,7 @@ export default {
form: {
handler: _.throttle(function() {
let query = _.pickBy(this.form)
Inertia.replace(this.route('users', Object.keys(query).length ? query : { remember: 'forget' }).url())
Inertia.replace(this.route('users', Object.keys(query).length ? query : { remember: 'forget' }))
}, 150),
deep: true,
},

2
resources/js/app.js vendored
View File

@ -3,7 +3,7 @@ import PortalVue from 'portal-vue'
import Vue from 'vue'
Vue.config.productionTip = false
Vue.mixin({ methods: { route: window.route } })
Vue.mixin({ methods: { route: (...args) => window.route(...args).url() } })
Vue.use(PortalVue)
let app = document.getElementById('app')