Files
radicall/resources/js/Client/layouts/AuthLayout.vue
T

71 lines
2.1 KiB
Vue
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup>
import { Link } from '@inertiajs/inertia-vue3';
import { watch, onMounted, ref } from 'vue';
import { usePage } from '@inertiajs/inertia-vue3';
import { toast } from 'vue3-toastify';
const page = usePage();
const lastFlash = ref(null);
const showToast = (type, message) => {
if (message) {
const toastOptions = {
position: 'top-right',
rtl: true,
theme: 'colored',
autoClose: 3000,
};
if (type === 'success') {
toast.success(message, toastOptions);
} else if (type === 'error') {
toast.error(message, toastOptions);
}
}
};
onMounted(() => {
const flash = page.props.value?.flash;
if (flash?.success || flash?.error) {
lastFlash.value = JSON.stringify(flash);
if (flash.success) {
showToast('success', flash.success);
}
if (flash.error) {
showToast('error', flash.error);
}
}
});
watch(() => page.props.value?.flash, (newFlash) => {
if (newFlash) {
const newFlashStr = JSON.stringify(newFlash);
if (newFlashStr !== lastFlash.value) {
lastFlash.value = newFlashStr;
if (newFlash.success) {
showToast('success', newFlash.success);
}
if (newFlash.error) {
showToast('error', newFlash.error);
}
}
}
}, { deep: true });
</script>
<template>
<div class="grid grid-cols-a relative grid-rows-[auto] items-center justify-center h-[100svh] w-full bg-dominant-50 content-center">
<Link href="/">
<figure class="flex justify-center mb-8">
<img src="@/images/radical_logo.png" alt="logo" class="w-[125px] h-auto object-cover"></img>
</figure>
</Link>
<slot />
<slot name="footer" class=""></slot>
<div class="absolute w-full text-center bottom-5 right-0 left-0 m-auto">
<p class="text-center text-[13px] max-sm:px-4 max-sm:leading-8 text-dominant-700 font-normal">تمامی حقوق این وب‌سایت برای مجموعه <span class="font-semibold">تله‌رادیولوژی رادیکال</span> محفوظ می‌باشد.</p>
</div>
</div>
</template>