Skip to content

Commit 3fb9c89

Browse files
pr feedback
1 parent 252114d commit 3fb9c89

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

resources/newssite/news-nuxt/composables/provide-locale.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,39 @@ export function provideLocale() {
2020

2121
const { content } = dataSource[lang];
2222

23-
const selected = Object.create(null);
23+
// Generate unique IDs for all articles, and their content items where appropriate.
24+
const contentWithIds = Object.create(null);
2425
Object.keys(content).forEach((key) => {
2526
const { sections } = content[key];
2627

27-
const selectedSections = [];
28-
29-
for (let i = 0; i < sections.length; i++) {
30-
const selectedSection = { ...sections[i] };
31-
selectedSections.push(selectedSection);
32-
33-
const { articles } = selectedSections[i];
34-
for (let j = 0; j < articles.length; j++) {
35-
articles[j].id = uuidv4();
36-
const { content } = articles[j];
37-
if (Array.isArray(content)) {
38-
for (let k = 0; k < content.length; k++)
39-
content[k].id = uuidv4();
28+
const currentSections = sections.map((section) => {
29+
const currentSection = { ...section };
30+
currentSection.articles = section.articles.map((article) => {
31+
const currentArticle = { ...article };
32+
currentArticle.id = uuidv4();
33+
if (Array.isArray(article.content)) {
34+
currentArticle.content = article.content.map((item) => {
35+
const currentItem = { ...item };
36+
currentItem.id = uuidv4();
37+
return currentItem;
38+
});
4039
}
40+
return currentArticle;
41+
});
42+
return currentSection;
43+
});
4144

42-
}
43-
}
44-
45-
selected[key] = {
45+
contentWithIds[key] = {
4646
...content[key],
47-
sections: selectedSections,
47+
sections: currentSections,
4848
};
4949
});
5050

5151
const value = {
5252
lang,
5353
dir,
5454
...dataSource[lang],
55-
content: selected,
55+
content: contentWithIds,
5656
};
5757

5858
provide("data", value);

resources/newssite/news-nuxt/dist/404.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<head><meta charset="utf-8">
44
<title>The Daily Broadcast</title>
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6-
<meta name="description" content="A news site developed with Nuxt."><link rel="modulepreload" as="script" crossorigin href="./_nuxt/entry.8b385d26.js"><link rel="preload" as="style" href="./_nuxt/entry.4163a698.css"><link rel="prefetch" as="script" crossorigin href="./_nuxt/error-component.649814ff.js"><link rel="stylesheet" href="./_nuxt/entry.4163a698.css"></head>
7-
<body ><div id="__nuxt"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4},{},false,{},{}]</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"./",buildAssetsDir:"/_nuxt/",cdnURL:"./"}}</script><script type="module" src="./_nuxt/entry.8b385d26.js" crossorigin></script></body>
6+
<meta name="description" content="A news site developed with Nuxt."><link rel="modulepreload" as="script" crossorigin href="./_nuxt/entry.30f4d106.js"><link rel="preload" as="style" href="./_nuxt/entry.4163a698.css"><link rel="prefetch" as="script" crossorigin href="./_nuxt/error-component.1bc5c237.js"><link rel="stylesheet" href="./_nuxt/entry.4163a698.css"></head>
7+
<body ><div id="__nuxt"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4},{},false,{},{}]</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"./",buildAssetsDir:"/_nuxt/",cdnURL:"./"}}</script><script type="module" src="./_nuxt/entry.30f4d106.js" crossorigin></script></body>
88
</html>

resources/newssite/news-nuxt/dist/_nuxt/entry.8b385d26.js renamed to resources/newssite/news-nuxt/dist/_nuxt/entry.30f4d106.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/newssite/news-nuxt/dist/_nuxt/error-404.f3fa63d8.js renamed to resources/newssite/news-nuxt/dist/_nuxt/error-404.f07efa12.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/newssite/news-nuxt/dist/_nuxt/error-500.67925fa1.js renamed to resources/newssite/news-nuxt/dist/_nuxt/error-500.f207c42f.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/newssite/news-nuxt/dist/_nuxt/error-component.649814ff.js renamed to resources/newssite/news-nuxt/dist/_nuxt/error-component.1bc5c237.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/newssite/news-nuxt/dist/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<head><meta charset="utf-8">
44
<title>The Daily Broadcast</title>
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6-
<meta name="description" content="A news site developed with Nuxt."><link rel="modulepreload" as="script" crossorigin href="./_nuxt/entry.8b385d26.js"><link rel="preload" as="style" href="./_nuxt/entry.4163a698.css"><link rel="prefetch" as="script" crossorigin href="./_nuxt/error-component.649814ff.js"><link rel="stylesheet" href="./_nuxt/entry.4163a698.css"></head>
7-
<body ><div id="__nuxt"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4},{},false,{},{}]</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"./",buildAssetsDir:"/_nuxt/",cdnURL:"./"}}</script><script type="module" src="./_nuxt/entry.8b385d26.js" crossorigin></script></body>
6+
<meta name="description" content="A news site developed with Nuxt."><link rel="modulepreload" as="script" crossorigin href="./_nuxt/entry.30f4d106.js"><link rel="preload" as="style" href="./_nuxt/entry.4163a698.css"><link rel="prefetch" as="script" crossorigin href="./_nuxt/error-component.1bc5c237.js"><link rel="stylesheet" href="./_nuxt/entry.4163a698.css"></head>
7+
<body ><div id="__nuxt"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4},{},false,{},{}]</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"./",buildAssetsDir:"/_nuxt/",cdnURL:"./"}}</script><script type="module" src="./_nuxt/entry.30f4d106.js" crossorigin></script></body>
88
</html>

0 commit comments

Comments
 (0)