* Page for single contract

feature: #9
This commit is contained in:
2023-01-06 00:34:35 +01:00
parent 49cd7b2c72
commit 0fc5cbe8e8
11 changed files with 331 additions and 22 deletions

View File

@@ -0,0 +1,33 @@
import HttpClient from '../api/HttpClient'
import router from '../router'
//Request in order to retrieve all contracts and print in table
//Backend: extra roles check. Allow admin, verwaltung, employee.
//REST: GET /contracts
//Auth: provide auth token in request
//OnError: redirect to page /error?message=somemessage&code=404
export async function getContracts() {
return HttpClient.get('contracts') //todo: provide here auth header
.then(resp => {
return resp.data.contracts
})
.catch(error => {
router.push('/error?message=' + error.message + '&code=' + error.code)
})
}
//Request in order to retrieve specific contract using ID
//Backend: extra roles check. Allow admin, verwaltung, employee.
//REST: GET /contract?id=someId
//Auth: provide auth token in request
//OnError: redirect to page /error?message=somemessage&code=404
export async function getContractById(identifier) {
return HttpClient.get('/contract', { params: { id: 'TESTID' } })
.then(resp => {
//todo: send also auth token with request
return resp.data
})
.catch(error => {
router.push('/error?message=' + error.message + '&code=' + error.code)
})
}