* fixes of error catching in posting comment

* function move to next step
feature: #12
This commit is contained in:
2023-01-13 15:02:23 +01:00
parent 71331b046d
commit 155b9f56cd
3 changed files with 31 additions and 14 deletions

View File

@@ -89,8 +89,13 @@ export default {
date: new Date()
}
saveComment(comment)
this.$router.go()
saveComment(comment, this.contract.id)
.then(resp => {
this.$router.go()
})
.catch(error => {
this.$router.push('/error?message=' + error.message + '&code=' + error.code)
})
}
}
}

View File

@@ -4,7 +4,8 @@
<!-- Draw buttons by roles -->
<button
type="button"
class="inline-block px-6 mr-3 py-2.5 bg-green-500 text-white font-medium text-xs rounded shadow-md">
class="inline-block px-6 mr-3 py-2.5 bg-green-500 text-white font-medium text-xs rounded shadow-md"
@click="nextStep()">
Nächstes Schritt
</button>
<button
@@ -111,12 +112,25 @@
</div>
</template>
<script>
import { moveToNextStep } from '../../service/ContractsService'
export default {
props: {
contract: {
type: Object,
default: () => ({})
}
},
methods: {
async nextStep() {
await moveToNextStep(this.contract.id)
.then(resp => {
this.$router.go()
})
.catch(error => {
this.$router.push('/error?message=' + error.message + '&code=' + error.code)
})
}
}
}
</script>