feat: showing limits for list creation
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user