feat: showing limits for list creation

This commit is contained in:
2025-08-30 11:17:24 +01:00
parent 8b54d502f2
commit 48579267b5
2 changed files with 15 additions and 2 deletions

View File

@@ -3,7 +3,8 @@ import { useSearchImageContext } from "@contexts/SearchImageContext";
import { ListCard } from "@components/list-card";
import { Button } from "@kobalte/core/button";
import { Dialog } from "@kobalte/core/dialog";
import { createList } from "../../network";
import { createList, ReachedListLimit } from "../../network";
import { createToast } from "../../utils/show-toast";
export const Categories: Component = () => {
const { lists, onRefetchImages } = useSearchImageContext();
@@ -27,6 +28,9 @@ export const Categories: Component = () => {
onRefetchImages(); // Refresh the lists
} catch (error) {
console.error("Failed to create list:", error);
if (error instanceof ReachedListLimit) {
createToast("Reached limit!", "You've reached your limit for new lists");
}
} finally {
setIsCreating(false);
}