Update admin page to refresh video data after edits
Refactor: Invalidate cache for '/api/admin/videos' and '/api/videos' in EditVideoDialog to refresh video data upon successful update. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 170e18f0-0f13-4eca-8643-546bba1dd8cc Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/170e18f0-0f13-4eca-8643-546bba1dd8cc/LY6xmBI
This commit is contained in:
parent
9202e323bc
commit
82fd6bed09
@ -209,6 +209,7 @@ function EditVideoDialog({
|
|||||||
onSuccess: () => void;
|
onSuccess: () => void;
|
||||||
}) {
|
}) {
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
|
const queryClient = useQueryClient();
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
title: video.title,
|
title: video.title,
|
||||||
description: video.description,
|
description: video.description,
|
||||||
@ -225,6 +226,10 @@ function EditVideoDialog({
|
|||||||
title: "Success",
|
title: "Success",
|
||||||
description: "Video updated successfully",
|
description: "Video updated successfully",
|
||||||
});
|
});
|
||||||
|
// Invalidate cache to refresh the video list
|
||||||
|
queryClient.invalidateQueries({ queryKey: ["/api/admin/videos"] });
|
||||||
|
queryClient.invalidateQueries({ queryKey: ["/api/videos"] });
|
||||||
|
onOpenChange(false);
|
||||||
onSuccess();
|
onSuccess();
|
||||||
},
|
},
|
||||||
onError: (error: any) => {
|
onError: (error: any) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user