diff --git a/resources/js/Pages/VacationRequest/Show.vue b/resources/js/Pages/VacationRequest/Show.vue
index 575893d..36ccb91 100644
--- a/resources/js/Pages/VacationRequest/Show.vue
+++ b/resources/js/Pages/VacationRequest/Show.vue
@@ -208,23 +208,15 @@
-
Anuluj wniosek
-
-
-
-
-
-
-
-
-
-
+
diff --git a/resources/js/Shared/ActionButton.vue b/resources/js/Shared/ActionButton.vue
deleted file mode 100644
index c47272e..0000000
--- a/resources/js/Shared/ActionButton.vue
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
diff --git a/resources/js/Shared/InertiaLink.js b/resources/js/Shared/InertiaLink.js
new file mode 100644
index 0000000..d279539
--- /dev/null
+++ b/resources/js/Shared/InertiaLink.js
@@ -0,0 +1,65 @@
+import { h, ref } from 'vue'
+import { Inertia, mergeDataIntoQueryString, shouldIntercept } from '@inertiajs/inertia'
+
+export default {
+ name: 'InertiaLink',
+ props: {
+ as: {
+ type: String,
+ default: 'a',
+ },
+ data: {
+ type: Object,
+ default: () => ({}),
+ },
+ href: {
+ type: String,
+ },
+ method: {
+ type: String,
+ default: 'get',
+ },
+ replace: {
+ type: Boolean,
+ default: false,
+ },
+ preserveScroll: {
+ type: Boolean,
+ default: false,
+ },
+ preserveState: {
+ type: Boolean,
+ default: null,
+ },
+ },
+ setup(props, { slots, attrs }) {
+ const processing = ref(false)
+
+ return props => {
+ const as = props.as.toLowerCase()
+ const method = props.method.toLowerCase()
+ const [href, data] = mergeDataIntoQueryString(method, props.href || '', props.data, 'brackets')
+
+ return h(props.as, {
+ ...attrs,
+ ...as === 'a' ? { href } : {},
+ onClick: (event) => {
+ if (shouldIntercept(event)) {
+ event.preventDefault()
+
+ Inertia.visit(href, {
+ data: data,
+ method: method,
+ replace: props.replace,
+ preserveScroll: props.preserveScroll,
+ preserveState: props.preserveState ?? (method !== 'get'),
+ onBefore: () => ! processing.value,
+ onStart: () => processing.value = true,
+ onFinish: () => processing.value = false,
+ })
+ }
+ },
+ }, slots)
+ }
+ },
+}
diff --git a/resources/js/app.js b/resources/js/app.js
index 1792ed7..22aee25 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -1,12 +1,12 @@
import { createApp, h } from 'vue'
-import { createInertiaApp, Head, Link } from '@inertiajs/inertia-vue3'
+import { createInertiaApp, Head } from '@inertiajs/inertia-vue3'
import { InertiaProgress } from '@inertiajs/progress'
import AppLayout from '@/Shared/Layout/AppLayout'
import Flatpickr from 'flatpickr'
import { Settings } from 'luxon'
import { Polish } from 'flatpickr/dist/l10n/pl.js'
import Toast from 'vue-toastification'
-import ActionButton from '@/Shared/ActionButton'
+import InertiaLink from '@/Shared/InertiaLink'
createInertiaApp({
resolve: name => {
@@ -25,8 +25,7 @@ createInertiaApp({
timeout: 3000,
pauseOnFocusLoss: false,
})
- .component('InertiaLink', Link)
- .component('ActionButton', ActionButton)
+ .component('InertiaLink', InertiaLink)
.component('InertiaHead', Head)
.mount(el)
},