initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { router } from '@inertiajs/vue3';
|
||||
import { toast } from 'vue-sonner';
|
||||
import type { FlashToast } from '@/types/ui';
|
||||
|
||||
export function initializeFlashToast(): void {
|
||||
router.on('flash', (event) => {
|
||||
const flash = (event as CustomEvent).detail?.flash;
|
||||
const data = flash?.toast as FlashToast | undefined;
|
||||
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
toast[data.type](data.message);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { InertiaLinkProps } from '@inertiajs/vue3';
|
||||
import { clsx } from 'clsx';
|
||||
import type { ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
export function toUrl(href: NonNullable<InertiaLinkProps['href']>) {
|
||||
return typeof href === 'string' ? href : href?.url;
|
||||
}
|
||||
Reference in New Issue
Block a user