Skip to content

Commit

Permalink
FIX #736
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinovega committed Sep 13, 2024
1 parent e170f59 commit 302eba3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { getApolloContext, gql } from '@apollo/client';
import { useQuery } from '@tanstack/react-query';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { useContext } from 'react';

import { I18nContext } from '../../../contexts';
Expand Down Expand Up @@ -54,14 +54,15 @@ export const LastDemands = (props: LastDemandsProps) => {
const { confirm } = useContext(ModalContext);
const { client } = useContext(getApolloContext());

const queryClient = useQueryClient()
const { isLoading, isError, data } = useQuery({
queryKey: ["widget", "widget_team_last_demands"],
queryFn: () => client?.query({
query: GET_TEAM_LAST_DEMANDS,
variables: { teamId: props.team._id, offset: 0, limit: 5 }
})
})
const isAdmin = !!props.team.users.find(u => u.userId === connectedUser._id && u.teamPermission === 'Administrator')
const isAdmin = !!props.team.users.find(u => u.userId === connectedUser._id && u.teamPermission === 'Administrator') || connectedUser.isDaikokuAdmin

const handleCheckout = (demandId: string) => {
return Services.rerunProcess(props.team._id, demandId)
Expand All @@ -76,6 +77,7 @@ export const LastDemands = (props: LastDemandsProps) => {
message: translate('demand.delete.modal.message')
})
.then(() => Services.cancelProcess(props.team._id, demandId))
.then(() => queryClient.invalidateQueries({ queryKey: ["widget", "widget_team_last_demands"] }));
}

return (
Expand Down

0 comments on commit 302eba3

Please sign in to comment.