Skip to content

Commit

Permalink
fix: handle versionnumber when creating revision
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreiffers committed Nov 9, 2023
1 parent 4dd9b8c commit 999b56d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/pages/concept-registration-page/form-concept/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { schema as validationSchema } from './form-concept.schema';
import SC from './styled';
import { InternalInfo } from './internal-info';
import { setValidationError } from '../../../features/conceptForm';
import { compareVersion } from '../../../utils/version';

export const validateWithPreProcess = (
values,
Expand Down Expand Up @@ -161,12 +162,16 @@ export const FormConceptPure: FC<Props> = ({
};

const createNewConceptRevisionAndNavigate = () =>
postConceptRevisionWithPreProcess(conceptId, publisherId, values).then(
resourceId => {
setShowUserPrompt(false);
history.push(`/${catalogId}/${resourceId}`);
}
);
postConceptRevisionWithPreProcess(conceptId, publisherId, {
...values,
versjonsnr:
compareVersion(values.versjonsnr, concept.versjonsnr) === 0
? null
: values.versjonsnr
}).then(resourceId => {
setShowUserPrompt(false);
history.push(`/${catalogId}/${resourceId}`);
});

useEffect(() => {
const handler = event => {
Expand Down

0 comments on commit 999b56d

Please sign in to comment.