Skip to content

Commit

Permalink
Merge pull request #20 from randombenj/bugfix/show-version
Browse files Browse the repository at this point in the history
fix(web): do not show invalid versions
  • Loading branch information
randombenj authored Nov 12, 2019
2 parents cb7b868 + 7042e39 commit 1ade830
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion web/src/components/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
},
async created() {
this.logoURL = ProjectRepository.getProjectLogoURL(this.project)
this.versions = (await ProjectRepository.getVersions(this.project)).data
this.versions = await ProjectRepository.getVersions(this.project)
this.latestVersion = (this.versions.find((version) => version.name == 'latest') || this.versions[0]).name
}
}
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Docs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {
async created() {
this.versions = (await ProjectRepository.getVersions(
this.$route.params.project
)).data.map((version) => version.name)
)).map((version) => version.name)
this.docURL = this.$route.params.location || ProjectRepository.getProjectDocsURL(
this.$route.params.project,
this.$route.params.version
Expand Down
6 changes: 4 additions & 2 deletions web/src/repositories/ProjectRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export default {
* this includes mainly the existing versions
* @param {string} projectName Name of the project
*/
getVersions(projectName) {
return Repository.get(`${Repository.defaults.baseURL}/${resource}/${projectName}/`)
async getVersions(projectName) {
return (await Repository.get(`${Repository.defaults.baseURL}/${resource}/${projectName}/`))
.data
.filter((version) => version.type == 'directory')
}
}

0 comments on commit 1ade830

Please sign in to comment.