mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
invalidate room on room update
This commit is contained in:
@@ -162,10 +162,21 @@ export function useRoomUpdate() {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
return $api.useMutation("patch", "/v1/rooms/{room_id}", {
|
return $api.useMutation("patch", "/v1/rooms/{room_id}", {
|
||||||
onSuccess: () => {
|
onSuccess: async (room) => {
|
||||||
|
await Promise.all([
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: $api.queryOptions("get", "/v1/rooms").queryKey,
|
queryKey: $api.queryOptions("get", "/v1/rooms").queryKey,
|
||||||
});
|
}),
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: $api.queryOptions("get", "/v1/rooms/{room_id}", {
|
||||||
|
params: {
|
||||||
|
path: {
|
||||||
|
room_id: room.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).queryKey,
|
||||||
|
}),
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
setError(error as Error, "There was an error updating the room");
|
setError(error as Error, "There was an error updating the room");
|
||||||
|
|||||||
Reference in New Issue
Block a user