Request get exos
This commit is contained in:
parent
bf62ac718b
commit
58646f7cd9
@ -70,7 +70,11 @@ class ExerciceAPI(APIView):
|
||||
userExosListSorted = userExos
|
||||
|
||||
if code != 'all' and code != 'pdf' and code != "web":
|
||||
exo = Exercice.objects.get(id_code=code)
|
||||
try:
|
||||
exo = Exercice.objects.get(id_code=code)
|
||||
except:
|
||||
exo = None
|
||||
return Response({'error': "Not found"}, status= status.HTTP_404_NOT_FOUND)
|
||||
isUser = False
|
||||
if request.user == exo.author:
|
||||
isUser = True
|
||||
|
@ -29,14 +29,16 @@ export default function ModalCard({ step, onClose, onDelete, tags, queryKey }) {
|
||||
const alert = useAlert();
|
||||
const [edit, setEdit] = useState(false);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
|
||||
const {
|
||||
isLoading: isUpdating,
|
||||
isFetching,
|
||||
data: step_data,
|
||||
} = useQuery(
|
||||
["exo-data", step.id_code],
|
||||
async () => await getExos(step.id_code),
|
||||
async () => await getExos(step.id_code).catch(() => {
|
||||
notificationService.error('Erreur', "Exercice introuvable")
|
||||
}),
|
||||
{ initialData: step, refetchOnWindowFocus: !edit }
|
||||
);
|
||||
const [selected, setSelected] = useState([]);
|
||||
|
Loading…
Reference in New Issue
Block a user