Applications Notifications

This commit is contained in:
headlessdev 2025-04-24 14:01:19 +02:00
parent 861eab8050
commit 512a5aa49e
2 changed files with 25 additions and 0 deletions

View File

@ -74,6 +74,8 @@ import {
TooltipTrigger, TooltipTrigger,
} from "@/components/ui/tooltip" } from "@/components/ui/tooltip"
import { StatusIndicator } from "@/components/status-indicator"; import { StatusIndicator } from "@/components/status-indicator";
import { Toaster } from "@/components/ui/sonner"
import { toast } from "sonner"
interface Application { interface Application {
id: number; id: number;
@ -152,8 +154,10 @@ export default function Dashboard() {
serverId, serverId,
}); });
getApplications(); getApplications();
toast.success("Application added successfully");
} catch (error: any) { } catch (error: any) {
console.log(error.response?.data); console.log(error.response?.data);
toast.error("Failed to add application");
} }
}; };
@ -170,6 +174,7 @@ export default function Dashboard() {
setLoading(false); setLoading(false);
} catch (error: any) { } catch (error: any) {
console.log(error.response?.data); console.log(error.response?.data);
toast.error("Failed to get applications");
} }
}; };
@ -185,8 +190,10 @@ export default function Dashboard() {
try { try {
await axios.post("/api/applications/delete", { id }); await axios.post("/api/applications/delete", { id });
getApplications(); getApplications();
toast.success("Application deleted successfully");
} catch (error: any) { } catch (error: any) {
console.log(error.response?.data); console.log(error.response?.data);
toast.error("Failed to delete application");
} }
}; };
@ -215,8 +222,10 @@ export default function Dashboard() {
}); });
getApplications(); getApplications();
setEditId(null); setEditId(null);
toast.success("Application edited successfully");
} catch (error: any) { } catch (error: any) {
console.log(error.response.data); console.log(error.response.data);
toast.error("Failed to edit application");
} }
}; };
@ -280,6 +289,7 @@ export default function Dashboard() {
</Breadcrumb> </Breadcrumb>
</div> </div>
</header> </header>
<Toaster />
<div className="p-6"> <div className="p-6">
<div className="flex justify-between items-center"> <div className="flex justify-between items-center">
<span className="text-3xl font-bold">Your Applications</span> <span className="text-3xl font-bold">Your Applications</span>

15
package-lock.json generated
View File

@ -5073,6 +5073,21 @@
"optional": true "optional": true
} }
} }
},
"node_modules/@next/swc-win32-x64-msvc": {
"version": "15.3.0",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.3.0.tgz",
"integrity": "sha512-vHUQS4YVGJPmpjn7r5lEZuMhK5UQBNBRSB+iGDvJjaNk649pTIcRluDWNb9siunyLLiu/LDPHfvxBtNamyuLTw==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
} }
} }
} }