Update to new Inertia plugin format

This commit is contained in:
Jonathan Reinink 2019-04-24 14:45:13 -04:00
parent b83fda83a5
commit 6e757083e3
16 changed files with 53 additions and 84 deletions

44
package-lock.json generated
View File

@ -1971,9 +1971,9 @@
}
},
"caniuse-lite": {
"version": "1.0.30000962",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000962.tgz",
"integrity": "sha512-WXYsW38HK+6eaj5IZR16Rn91TGhU3OhbwjKZvJ4HN/XBIABLKfbij9Mnd3pM0VEwZSlltWjoWg3I8FQ0DGgNOA==",
"version": "1.0.30000963",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000963.tgz",
"integrity": "sha512-n4HUiullc7Lw0LyzpeLa2ffP8KxFBGdxqD/8G3bSL6oB758hZ2UE2CVK+tQN958tJIi0/tfpjAc67aAtoHgnrQ==",
"dev": true
},
"chalk": {
@ -2138,9 +2138,9 @@
}
},
"color": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/color/-/color-3.1.0.tgz",
"integrity": "sha512-CwyopLkuRYO5ei2EpzpIh6LqJMt6Mt+jZhO5VI5f/wJLZriXQE32/SSqzmrh+QB+AZT81Cj8yv+7zwToW8ahZg==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/color/-/color-3.1.1.tgz",
"integrity": "sha512-PvUltIXRjehRKPSy89VnDWFKY58xyhTLyxIg21vwQBI6qLwZNPmC8k3C1uytIgFKEpOIzN4y32iPm8231zFHIg==",
"dev": true,
"requires": {
"color-convert": "^1.9.1",
@ -5123,22 +5123,20 @@
"dev": true
},
"inertia": {
"version": "github:inertiajs/inertia#280a85a07dcb7ac02fb236fdbb68810a4be1e128",
"version": "github:inertiajs/inertia#52829f02f5db25b033d3ea925cae4836cd11bfa6",
"from": "github:inertiajs/inertia",
"dev": true,
"requires": {
"axios": "^0.18.0",
"lodash": "^4.17.5",
"melanke-watchjs": "^1.5.0",
"nprogress": "^0.2.0"
}
},
"inertia-vue": {
"version": "github:inertiajs/inertia-vue#7e6cff62e2ebdc0f432ec146a293cfd1fc88f329",
"version": "github:inertiajs/inertia-vue#de7306319de89777c82d51c48d63df59453ee0c9",
"from": "github:inertiajs/inertia-vue",
"dev": true,
"requires": {
"inertia": "github:inertiajs/inertia#280a85a07dcb7ac02fb236fdbb68810a4be1e128"
"inertia": "github:inertiajs/inertia#52829f02f5db25b033d3ea925cae4836cd11bfa6"
}
},
"inflight": {
@ -5959,12 +5957,6 @@
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
"dev": true
},
"melanke-watchjs": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/melanke-watchjs/-/melanke-watchjs-1.5.0.tgz",
"integrity": "sha512-YUQzBucdH5p3s/UPQ0fvYyzqRfyLKTS35Qj5iaVBQ6XYGvvpEX7afR1xi8uUGsTEfFNqDFRrADz9TkVu4/TeXQ==",
"dev": true
},
"mem": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz",
@ -6320,9 +6312,9 @@
}
},
"node-releases": {
"version": "1.1.15",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.15.tgz",
"integrity": "sha512-cKV097BQaZr8LTSRUa2+oc/aX5L8UkZtPQrMSTgiJEeaW7ymTDCoRaGCoaTqk0lqnalcoSHu4wjSl0Cmj2+bMw==",
"version": "1.1.17",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.17.tgz",
"integrity": "sha512-/SCjetyta1m7YXLgtACZGDYJdCSIBAWorDWkGCGZlydP2Ll7J48l7j/JxNYZ+xsgSPbWfdulVS/aY+GdjUsQ7Q==",
"dev": true,
"requires": {
"semver": "^5.3.0"
@ -8090,9 +8082,9 @@
"dev": true
},
"resolve": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz",
"integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==",
"version": "1.10.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.1.tgz",
"integrity": "sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
@ -8252,9 +8244,9 @@
}
},
"rxjs": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.4.0.tgz",
"integrity": "sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==",
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.1.tgz",
"integrity": "sha512-y0j31WJc83wPu31vS1VlAFW5JGrnGC+j+TtGAa1fRQphy48+fDYiDmX8tjGloToEsMkxnouOg/1IzXGKkJnZMg==",
"dev": true,
"requires": {
"tslib": "^1.9.0"

View File

@ -23,7 +23,6 @@
</template>
<script>
import { Inertia } from 'inertia-vue'
import LoadingButton from '@/Shared/LoadingButton'
import Logo from '@/Shared/Logo'
import TextInput from '@/Shared/TextInput'
@ -54,7 +53,7 @@ export default {
methods: {
submit() {
this.sending = true
Inertia.post(this.route('login.attempt'), {
this.$inertia.post(this.route('login.attempt'), {
email: this.form.email,
password: this.form.password,
remember: this.form.remember,

View File

@ -34,7 +34,6 @@
</template>
<script>
import { Inertia, InertiaLink } from 'inertia-vue'
import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
@ -42,7 +41,6 @@ import TextInput from '@/Shared/TextInput'
export default {
components: {
InertiaLink,
Layout,
LoadingButton,
SelectInput,
@ -55,10 +53,11 @@ export default {
default: () => ({}),
},
},
remember: 'form',
data() {
return {
sending: false,
form: Inertia.remember({
form: {
first_name: null,
last_name: null,
organization_id: null,
@ -69,13 +68,13 @@ export default {
region: null,
country: null,
postal_code: null,
}),
},
}
},
methods: {
submit() {
this.sending = true
Inertia.post(this.route('contacts.store'), this.form)
this.$inertia.post(this.route('contacts.store'), this.form)
.then(() => this.sending = false)
},
},

View File

@ -39,7 +39,6 @@
</template>
<script>
import { Inertia, InertiaLink } from 'inertia-vue'
import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
@ -48,7 +47,6 @@ import TrashedMessage from '@/Shared/TrashedMessage'
export default {
components: {
InertiaLink,
Layout,
LoadingButton,
SelectInput,
@ -63,10 +61,11 @@ export default {
default: () => ({}),
},
},
remember: 'form',
data() {
return {
sending: false,
form: Inertia.remember({
form: {
first_name: this.contact.first_name,
last_name: this.contact.last_name,
organization_id: this.contact.organization_id,
@ -77,23 +76,23 @@ export default {
region: this.contact.region,
country: this.contact.country,
postal_code: this.contact.postal_code,
}),
},
}
},
methods: {
submit() {
this.sending = true
Inertia.put(this.route('contacts.update', this.contact.id), this.form)
this.$inertia.put(this.route('contacts.update', this.contact.id), this.form)
.then(() => this.sending = false)
},
destroy() {
if (confirm('Are you sure you want to delete this contact?')) {
Inertia.delete(this.route('contacts.destroy', this.contact.id))
this.$inertia.delete(this.route('contacts.destroy', this.contact.id))
}
},
restore() {
if (confirm('Are you sure you want to restore this contact?')) {
Inertia.put(this.route('contacts.restore', this.contact.id))
this.$inertia.put(this.route('contacts.restore', this.contact.id))
}
},
},

View File

@ -64,7 +64,6 @@
<script>
import _ from 'lodash'
import { Inertia, InertiaLink } from 'inertia-vue'
import Icon from '@/Shared/Icon'
import Layout from '@/Shared/Layout'
import Pagination from '@/Shared/Pagination'
@ -72,7 +71,6 @@ import SearchFilter from '@/Shared/SearchFilter'
export default {
components: {
InertiaLink,
Icon,
Layout,
Pagination,
@ -94,7 +92,7 @@ export default {
form: {
handler: _.throttle(function() {
let query = _.pickBy(this.form)
Inertia.replace(this.route('contacts', Object.keys(query).length ? query : { remember: 'forget' }))
this.$inertia.replace(this.route('contacts', Object.keys(query).length ? query : { remember: 'forget' }))
}, 150),
deep: true,
},

View File

@ -10,13 +10,11 @@
</template>
<script>
import { InertiaLink } from 'inertia-vue'
import Layout from '@/Shared/Layout'
export default {
components: {
Layout,
InertiaLink,
},
}
</script>

View File

@ -29,7 +29,6 @@
</template>
<script>
import { Inertia, InertiaLink } from 'inertia-vue'
import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
@ -37,7 +36,6 @@ import TextInput from '@/Shared/TextInput'
export default {
components: {
InertiaLink,
Layout,
LoadingButton,
SelectInput,
@ -49,10 +47,11 @@ export default {
default: () => ({}),
},
},
remember: ['form'],
data() {
return {
sending: false,
form: Inertia.remember({
form: {
name: null,
email: null,
phone: null,
@ -61,13 +60,13 @@ export default {
region: null,
country: null,
postal_code: null,
}),
},
}
},
methods: {
submit() {
this.sending = true
Inertia.post(this.route('organizations.store'), this.form)
this.$inertia.post(this.route('organizations.store'), this.form)
.then(() => this.sending = false)
},
},

View File

@ -70,7 +70,6 @@
</template>
<script>
import { Inertia, InertiaLink } from 'inertia-vue'
import Icon from '@/Shared/Icon'
import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
@ -80,7 +79,6 @@ import TrashedMessage from '@/Shared/TrashedMessage'
export default {
components: {
InertiaLink,
Icon,
Layout,
LoadingButton,
@ -95,10 +93,11 @@ export default {
default: () => ({}),
},
},
remember: ['form'],
data() {
return {
sending: false,
form: Inertia.remember({
form: {
name: this.organization.name,
email: this.organization.email,
phone: this.organization.phone,
@ -107,23 +106,23 @@ export default {
region: this.organization.region,
country: this.organization.country,
postal_code: this.organization.postal_code,
}),
},
}
},
methods: {
submit() {
this.sending = true
Inertia.put(this.route('organizations.update', this.organization.id), this.form)
this.$inertia.put(this.route('organizations.update', this.organization.id), this.form)
.then(() => this.sending = false)
},
destroy() {
if (confirm('Are you sure you want to delete this organization?')) {
Inertia.delete(this.route('organizations.destroy', this.organization.id))
this.$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))
this.$inertia.put(this.route('organizations.restore', this.organization.id))
}
},
},

View File

@ -56,7 +56,6 @@
<script>
import _ from 'lodash'
import { Inertia, InertiaLink } from 'inertia-vue'
import Icon from '@/Shared/Icon'
import Layout from '@/Shared/Layout'
import Pagination from '@/Shared/Pagination'
@ -64,7 +63,6 @@ import SearchFilter from '@/Shared/SearchFilter'
export default {
components: {
InertiaLink,
Icon,
Layout,
Pagination,
@ -86,7 +84,7 @@ export default {
form: {
handler: _.throttle(function() {
let query = _.pickBy(this.form)
Inertia.replace(this.route('organizations', Object.keys(query).length ? query : { remember: 'forget' }))
this.$inertia.replace(this.route('organizations', Object.keys(query).length ? query : { remember: 'forget' }))
}, 150),
deep: true,
},

View File

@ -25,7 +25,6 @@
</template>
<script>
import { Inertia, InertiaLink } from 'inertia-vue'
import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
@ -33,7 +32,6 @@ import TextInput from '@/Shared/TextInput'
export default {
components: {
InertiaLink,
Layout,
LoadingButton,
SelectInput,
@ -45,22 +43,23 @@ export default {
default: () => ({}),
},
},
remember: 'form',
data() {
return {
sending: false,
form: Inertia.remember({
form: {
first_name: null,
last_name: null,
email: null,
password: null,
owner: false,
}),
},
}
},
methods: {
submit() {
this.sending = true
Inertia.post(this.route('users.store'), this.form)
this.$inertia.post(this.route('users.store'), this.form)
.then(() => this.sending = false)
},
},

View File

@ -30,7 +30,6 @@
</template>
<script>
import { Inertia, InertiaLink } from 'inertia-vue'
import Layout from '@/Shared/Layout'
import LoadingButton from '@/Shared/LoadingButton'
import SelectInput from '@/Shared/SelectInput'
@ -39,7 +38,6 @@ import TrashedMessage from '@/Shared/TrashedMessage'
export default {
components: {
InertiaLink,
Layout,
LoadingButton,
SelectInput,
@ -53,32 +51,33 @@ export default {
default: () => ({}),
},
},
remember: 'form',
data() {
return {
sending: false,
form: Inertia.remember({
form: {
first_name: this.user.first_name,
last_name: this.user.last_name,
email: this.user.email,
password: this.user.password,
owner: this.user.owner,
}),
},
}
},
methods: {
submit() {
this.sending = true
Inertia.put(this.route('users.update', this.user.id), this.form)
this.$inertia.put(this.route('users.update', this.user.id), this.form)
.then(() => this.sending = false)
},
destroy() {
if (confirm('Are you sure you want to delete this user?')) {
Inertia.delete(this.route('users.destroy', this.user.id))
this.$inertia.delete(this.route('users.destroy', this.user.id))
}
},
restore() {
if (confirm('Are you sure you want to restore this user?')) {
Inertia.put(this.route('users.restore', this.user.id))
this.$inertia.put(this.route('users.restore', this.user.id))
}
},
},

View File

@ -61,14 +61,12 @@
<script>
import _ from 'lodash'
import { Inertia, InertiaLink } from 'inertia-vue'
import Icon from '@/Shared/Icon'
import Layout from '@/Shared/Layout'
import SearchFilter from '@/Shared/SearchFilter'
export default {
components: {
InertiaLink,
Icon,
Layout,
SearchFilter,
@ -90,7 +88,7 @@ export default {
form: {
handler: _.throttle(function() {
let query = _.pickBy(this.form)
Inertia.replace(this.route('users', Object.keys(query).length ? query : { remember: 'forget' }))
this.$inertia.replace(this.route('users', Object.keys(query).length ? query : { remember: 'forget' }))
}, 150),
deep: true,
},

View File

@ -47,7 +47,6 @@
</template>
<script>
import { InertiaLink } from 'inertia-vue'
import Dropdown from '@/Shared/Dropdown'
import Icon from '@/Shared/Icon'
import Logo from '@/Shared/Logo'
@ -55,7 +54,6 @@ import MainMenu from '@/Shared/MainMenu'
export default {
components: {
InertiaLink,
Dropdown,
Icon,
Logo,

View File

@ -28,12 +28,10 @@
</template>
<script>
import { InertiaLink } from 'inertia-vue'
import Icon from '@/Shared/Icon'
export default {
components: {
InertiaLink,
Icon,
},
methods: {

View File

@ -8,12 +8,7 @@
</template>
<script>
import { InertiaLink } from 'inertia-vue'
export default {
components: {
InertiaLink,
},
props: {
links: Array,
},

1
resources/js/app.js vendored
View File

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