feat(sep): add vclaim region service + fix server req

This commit is contained in:
riefive
2025-10-17 15:18:46 +07:00
parent 90ab600755
commit db15ddfb9a
5 changed files with 53 additions and 3 deletions
+6
View File
@@ -7,6 +7,7 @@ import type { PatientEntity } from '~/models/patient'
// Services
import { getPatientDetail, getPatients } from '~/services/patient.service'
import { getList as getDiagnoseReferralList } from '~/services/vclaim-diagnose-referral.service'
import { getList as getVclaimMonitoringVisitList } from '~/services/vclaim-monitoring-visit.service'
import { getList as getVclaimMonitoringHistoryList } from '~/services/vclaim-monitoring-history.service'
@@ -158,6 +159,11 @@ function handleEvent(value: string) {
}
onMounted(() => {
getDiagnoseReferralList().then(
(value) => {
console.log('value:', value)
},
)
getVclaimMonitoringHistoryList({ nop: '0002078925513', tglawal: '2025-07-20', tglakhir: '2025-10-10' }).then(
(value) => {
console.log('value:', value)
@@ -0,0 +1,14 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/cities'
const name = 'cities'
export function getList(params: any = null) {
let url = path
if (params?.province) {
url += `/${params.province}`
delete params.province
}
return base.getList(url, params, name)
}
@@ -0,0 +1,14 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/districts'
const name = 'districts'
export function getList(params: any = null) {
let url = path
if (params?.city) {
url += `/${params.city}`
delete params.city
}
return base.getList(url, params, name)
}
@@ -0,0 +1,9 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/provinces'
const name = 'provinces'
export function getList(params: any = null) {
return base.getList(path, params, name)
}
+10 -3
View File
@@ -27,8 +27,10 @@ export default defineEventHandler(async (event) => {
}
const forwardHeaders = new Headers()
if (headers['content-type']) forwardHeaders.set('Content-Type', headers['content-type'])
if (!isVclaim) forwardHeaders.set('Authorization', `Bearer ${bearer}`)
if (!isVclaim) {
if (headers['content-type']) forwardHeaders.set('Content-Type', headers['content-type'])
forwardHeaders.set('Authorization', `Bearer ${bearer}`)
}
let body: any
if (['POST', 'PATCH'].includes(method!)) {
@@ -48,7 +50,12 @@ export default defineEventHandler(async (event) => {
})
if (isVclaim) {
console.log('res:', res)
const resClone = res.clone()
return {
status: resClone.status,
headers: resClone.headers,
body: await resClone.json(),
}
}
return res