feat: filtre les scores en production
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

This commit is contained in:
Simon 2023-10-19 16:27:48 +02:00
parent 2960b936b1
commit 7a61fc4907
2 changed files with 6 additions and 1 deletions

View File

@ -10,5 +10,6 @@ module.exports = {
],
env: {
"vue/setup-compiler-macros": true,
node: true,
},
};

View File

@ -47,7 +47,11 @@ async function fetchScoresData() {
const url = `/items/scores?${fields
.map((item) => `fields[]=${item}`)
.join("&")}`;
const scores = (await fetchJSONApi(url)).data;
let scores = (await fetchJSONApi(url)).data;
if (process.env.NODE_ENV != "staging") {
console.log("Suppresion des scores avec le mode brouillon en production");
scores = scores.filter((score) => !score.draft);
}
await fs.writeFile("./src/data.json", JSON.stringify(scores), "utf8");
const folder = "public/answers";