新增單位管理以及一些功能修正
This commit is contained in:
@@ -15,7 +15,7 @@ import {
|
||||
User,
|
||||
ChevronDown
|
||||
} from "lucide-react";
|
||||
import { Toaster } from "sonner";
|
||||
import { toast, Toaster } from "sonner";
|
||||
import { useState, useEffect } from "react";
|
||||
import { Link, usePage } from "@inertiajs/react";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -139,6 +139,20 @@ export default function AuthenticatedLayout({
|
||||
localStorage.setItem("sidebar-collapsed", String(isCollapsed));
|
||||
}, [isCollapsed]);
|
||||
|
||||
// 全域監聽 flash 訊息並顯示 Toast
|
||||
useEffect(() => {
|
||||
// @ts-ignore
|
||||
if (props.flash?.success) {
|
||||
// @ts-ignore
|
||||
toast.success(props.flash.success);
|
||||
}
|
||||
// @ts-ignore
|
||||
if (props.flash?.error) {
|
||||
// @ts-ignore
|
||||
toast.error(props.flash.error);
|
||||
}
|
||||
}, [props.flash]);
|
||||
|
||||
const toggleExpand = (itemId: string) => {
|
||||
if (isCollapsed) {
|
||||
setIsCollapsed(false);
|
||||
|
||||
Reference in New Issue
Block a user