Skip to content

Commit

Permalink
repetition in new view only if already at least one ascent on this cr…
Browse files Browse the repository at this point in the history
…ag route
  • Loading branch information
pectum83 committed Dec 19, 2024
1 parent 2f59fb2 commit 59411b8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/ascentCragRoutes/EditCragAscentBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
:ascent-crag-route="ascentCragRoute"
submit-methode="put"
:callback="successCallback"
:repetition=true
:repetition="true"
/>
</v-card-text>
</v-card>
Expand Down
2 changes: 1 addition & 1 deletion components/cragRoutes/CragRouteAscent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default {
.catch((err) => {
this.$root.$emit('alertFromApiError', err, 'ascentCragRouteApi')
})
.then(() => {
.finally(() => {
this.loadingAscents = false
})
}
Expand Down
24 changes: 23 additions & 1 deletion pages/ascents/outdoor/new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
submit-methode="post"
:crag-route="cragRoute"
:callback="ascentAdded"
:repetition=true
:repetition="ascents.length > 0"
/>
</v-sheet>

Expand Down Expand Up @@ -272,6 +272,8 @@ import AscentCragRouteForm from '~/components/ascentCragRoutes/forms/AscentCragR
import CragRoutes from '~/components/cragRoutes/CragRoutes'
import MyFollowedCrags from '~/components/users/MyFollowedCrags'
import CragRouteDrawer from '~/components/cragRoutes/CragRouteDrawer'
import AscentCragRouteApi from '~/services/oblyk-api/AscentCragRouteApi'
import AscentCragRoute from '~/models/AscentCragRoute'
export default {
meta: { orphanRoute: true },
Expand All @@ -298,6 +300,7 @@ export default {
grade: null,
loadingGrade: false,
successAdded: false,
ascents: [],
mdiTerrain,
mdiPlus,
Expand Down Expand Up @@ -395,6 +398,25 @@ export default {
.finally(() => {
this.loadingCragRoute = false
})
this.getAscents(cragRouteId)
},
getAscents (cragRouteId) {
this.loadingAscents = true
this.ascents = []
new AscentCragRouteApi(this.$axios, this.$auth)
.all(cragRouteId)
.then((resp) => {
for (const ascent of resp.data) {
this.ascents.push(new AscentCragRoute({ attributes: ascent }))
}
})
.catch((err) => {
this.$root.$emit('alertFromApiError', err, 'ascentCragRouteApi')
})
.finally(() => {
this.loadingAscents = false
})
},
haveCragRoutesResults (results) {
Expand Down

0 comments on commit 59411b8

Please sign in to comment.