feat(material): create model interface of material

This commit is contained in:
riefive
2025-09-18 13:19:15 +07:00
parent 9ce5038e62
commit 117e72fdce
3 changed files with 24 additions and 4 deletions
+12 -3
View File
@@ -26,8 +26,13 @@ const items = [
// Fungsi untuk fetch data equipment
async function fetchEquipmentData(params: any) {
const endpoint = transform('/api/v1/equipment', params)
return await xfetch(endpoint)
// const endpoint = transform('/api/v1/equipment', params)
// return await xfetch(endpoint)
return await xfetch('/api/v1/material')
}
async function fetchUom() {
return await xfetch('/api/v1/uom')
}
// Menggunakan composable untuk pagination
@@ -169,10 +174,14 @@ const handleCancelConfirmation = () => {
recAction.value = ''
recItem.value = null
}
onMounted(async () => {
await fetchUom()
})
</script>
<template>
<div class="rounded-md border p-4">
<div class="p-4">
<Header v-model="searchInput" :prep="headerPrep" @search="handleSearch" />
<div class="rounded-md border p-4">
<AppEquipmentList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+6
View File
@@ -0,0 +1,6 @@
export interface EquipmentMaterial {
code: string;
name: string;
uom_code: string;
stock: number;
}
+6 -1
View File
@@ -7,9 +7,12 @@ export default defineEventHandler(async (event) => {
const { method } = event.node.req
const headers = getRequestHeaders(event)
const url = getRequestURL(event)
const config = useRuntimeConfig()
const apiOrigin = config.API_ORIGIN || API_ORIGIN
const pathname = url.pathname.replace(/^\/api/, '')
const targetUrl = API_ORIGIN + pathname + (url.search || '')
const targetUrl = apiOrigin + pathname + (url.search || '')
const verificationId = headers['verification-id'] as string | undefined
let bearer = ''
@@ -35,6 +38,8 @@ export default defineEventHandler(async (event) => {
}
}
console.log(targetUrl)
const res = await fetch(targetUrl, {
method,
headers: forwardHeaders,