Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix production mode detection for dataset view #73

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/components/DatasetView/DatasetMainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,19 @@ export default {
},
methods: {
fetchDatasets() {
Axios.get('/api/mode').then((response) => {
const isProduction = response.mode.isProduction;
this.isProduction = isProduction;
}).catch((error) => {
console.error(error);
this.isProduction = true;
});
Axios.get('/api/datasets')
.then((response) => {
this.allDatasets = response.data;
if (!this.selectedDataset && this.allDatasets.length > 0) {
this.selectedDataset = this.allDatasets[0];
}
for (const dataset of this.allDatasets) {
if (!dataset.isProduction) {
this.isProduction = false;
break;
}
}
})
.catch((error) => {
console.error(error);
Expand Down
5 changes: 4 additions & 1 deletion src/server/Mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const database = require("./utils/Database");
router.get("/", async (_, res) => {
try {
const mode = database.getAccessModeString();
res.send({ mode });
res.send({
mode,
isProduction: process.env.NODE_ENV === "production",
});
} catch (err) {
return res.status(400).send({ error: err.message });
}
Expand Down