* 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()
|
date: new Date()
|
||||||
}
|
}
|
||||||
|
|
||||||
saveComment(comment)
|
saveComment(comment, this.contract.id)
|
||||||
this.$router.go()
|
.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 -->
|
<!-- Draw buttons by roles -->
|
||||||
<button
|
<button
|
||||||
type="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
|
Nächstes Schritt
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@@ -111,12 +112,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { moveToNextStep } from '../../service/ContractsService'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
contract: {
|
contract: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
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>
|
</script>
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export async function createContract(contractId, contractName, contractClient, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteContract(contractId) {
|
export async function deleteContract(contractId) {
|
||||||
return HttpClient.delete('/contract', {
|
return HttpClient.delete('/contract/delete', {
|
||||||
id: contractId
|
id: contractId
|
||||||
})
|
})
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
@@ -106,14 +106,12 @@ export async function deleteContract(contractId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function saveComment(comment) {
|
export async function saveComment(comment, contractId) {
|
||||||
return HttpClient.post('/comments', comment)
|
return HttpClient.post('/contract/' + contractId + '/comments', comment)
|
||||||
.then(resp => {
|
}
|
||||||
//TODO: send also auth token with request
|
|
||||||
return resp.data
|
export async function moveToNextStep(contractId) {
|
||||||
})
|
return HttpClient.post('/contract/nextstep', {
|
||||||
.catch(error => {
|
id: contractId
|
||||||
console.error(error)
|
})
|
||||||
router.push('/error?message=' + error.message + '&code=' + error.code)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user