Skip to content

Commit

Permalink
[DEV-2070] Rename "version" to "subpath" in UrlReplaceMapCodec (#1279)
Browse files Browse the repository at this point in the history
* Rename "version" to "subPath" in UrlReplaceMapCodec

* Fix changeset

* Fix mocked Strapi response in urlReplaceMap's test
  • Loading branch information
marcobottaro authored Jan 8, 2025
1 parent 58a536a commit d69c97f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tall-boxes-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextjs-website": patch
---

Rename "version" to "subPath" in UrlReplaceMapCodec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const strapiResponse = {
{
id: 1,
url: 'aaaa',
version: '2',
subPath: '2',
guide: {
data: {
id: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NullToUndefinedCodec } from './NullToUndefinedCodec';
const UrlToGuideCodec = t.strict({
id: t.number,
url: t.string,
version: t.union([NullToUndefinedCodec, t.string]),
subPath: t.union([NullToUndefinedCodec, t.string]),
guide: t.strict({
data: t.union([NullToUndefinedCodec, GuideCodec]),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function makeUrlReplaceMap(
[obj.url]: `/${
obj.guide.data?.attributes.product.data.attributes.slug
}/guides/${obj.guide.data?.attributes.slug}${
obj.version ? `/${obj.version}` : ''
obj.subPath ? `/${obj.subPath}` : ''
}`,
};
}, {} as UrlReplaceMap);
Expand Down

0 comments on commit d69c97f

Please sign in to comment.