* fixes of error catching in posting comment
* function move to next step feature: #12
This commit is contained in:
@@ -89,8 +89,13 @@ export default {
|
||||
date: new Date()
|
||||
}
|
||||
|
||||
saveComment(comment)
|
||||
saveComment(comment, this.contract.id)
|
||||
.then(resp => {
|
||||
this.$router.go()
|
||||
})
|
||||
.catch(error => {
|
||||
this.$router.push('/error?message=' + error.message + '&code=' + error.code)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -93,7 +93,7 @@ export async function createContract(contractId, contractName, contractClient, c
|
||||
}
|
||||
|
||||
export async function deleteContract(contractId) {
|
||||
return HttpClient.delete('/contract', {
|
||||
return HttpClient.delete('/contract/delete', {
|
||||
id: contractId
|
||||
})
|
||||
.then(resp => {
|
||||
@@ -106,14 +106,12 @@ export async function deleteContract(contractId) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function saveComment(comment) {
|
||||
return HttpClient.post('/comments', comment)
|
||||
.then(resp => {
|
||||
//TODO: send also auth token with request
|
||||
return resp.data
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
router.push('/error?message=' + error.message + '&code=' + error.code)
|
||||
export async function saveComment(comment, contractId) {
|
||||
return HttpClient.post('/contract/' + contractId + '/comments', comment)
|
||||
}
|
||||
|
||||
export async function moveToNextStep(contractId) {
|
||||
return HttpClient.post('/contract/nextstep', {
|
||||
id: contractId
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user