File tree 2 files changed +4
-2
lines changed
contentTree/contentTreeEntry
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ type Props = {
13
13
export const getContentIconUrl = ( type : string ) =>
14
14
`${ import . meta. env . VITE_APP_ORIGIN } /xp/api/contentIcon?type=${ type } ` ;
15
15
16
- export const updateContentUrl = ( id : string , locale : string ) => {
17
- const newUrl = `${ xpArchiveConfig . basePath } /${ id } /${ locale } ` ;
16
+ export const updateContentUrl = ( nodeId : string , locale : string , versionId ? : string ) => {
17
+ const newUrl = `${ xpArchiveConfig . basePath } /${ nodeId } /${ locale } / ${ versionId ?? '' } ` ;
18
18
window . history . pushState ( { } , '' , newUrl ) ;
19
19
} ;
20
20
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { VersionReference } from 'shared/types';
4
4
import { pruneString } from '@common/shared/pruneString' ;
5
5
import { formatTimestamp } from '@common/shared/timestamp' ;
6
6
import { useAppState } from 'client/context/appState/useAppState' ;
7
+ import { updateContentUrl } from 'client/contentTree/contentTreeEntry/NavigationItem' ;
7
8
8
9
// function getOptions(versions: VersionReference[]): { label: string; value: string }[] {
9
10
// const sisteVersjon = { label: 'Siste versjon', value: 'Siste versjon' };
@@ -29,6 +30,7 @@ export const VersionSelector = ({ versions }: Props) => {
29
30
const versionId = e . target . value ;
30
31
const nodeId = versions . find ( ( v ) => v . versionId === versionId ) ?. nodeId ;
31
32
setSelectedVersion ( { nodeId, versionId } ) ;
33
+ updateContentUrl ( nodeId ?? '' , 'no' , versionId ) ; // TODO: fiks hardkodet locale
32
34
} ;
33
35
34
36
// const selectVersionC = (versionId: string) => {
You can’t perform that action at this time.
0 commit comments