Skip to content

Commit

Permalink
(fix): Correctly mutate generation of reports
Browse files Browse the repository at this point in the history
  • Loading branch information
makombe committed Oct 28, 2024
1 parent c880a78 commit f92799e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Controller, useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { StockReportSchema, reportSchema } from '../report-validation-schema';
import { useConcept, useStockTagLocations } from '../../stock-lookups/stock-lookups.resource';
import { ConfigObject, showSnackbar, useConfig } from '@openmrs/esm-framework';
import { ConfigObject, restBaseUrl, showSnackbar, useConfig } from '@openmrs/esm-framework';
import { Concept } from '../../core/api/types/concept/Concept';
import { createBatchJob } from '../../stock-batch/stock-batch.resource';
import {
Expand All @@ -34,6 +34,7 @@ import {
} from '../ReportType';
import { formatDisplayDate } from '../../core/utils/datetimeUtils';
import { BatchJobTypeReport } from '../../core/api/types/BatchJob';
import { handleMutate } from '../../utils';
interface CreateReportProps {
model?: ReportModel;
}
Expand Down Expand Up @@ -319,6 +320,7 @@ const CreateReport: React.FC<CreateReportProps> = ({ model }) => {
subtitle: t('BatchJobSuccess', 'Batch job created successfully'),
kind: 'success',
});
handleMutate(`${restBaseUrl}/stockmanagement/batchjob?batchJobType=Report&v=default`);
} else {
showSnackbar({
title: t('BatchJobErrorTitle', 'Batch job'),
Expand Down
2 changes: 1 addition & 1 deletion src/stock-reports/report-list/stock-reports.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const StockReports: React.FC = () => {
const { t } = useTranslation();

const handleRefresh = () => {
handleMutate(`${restBaseUrl}/stockmanagement/report?v=default`);
handleMutate(`${restBaseUrl}/stockmanagement/batchjob?batchJobType=Report&v=default`);
};
const { reports, isLoading, currentPage, pageSizes, totalItems, goTo, currentPageSize, setPageSize } =
useGetReports();
Expand Down

0 comments on commit f92799e

Please sign in to comment.