feat(material): create model interface of material
This commit is contained in:
No files matched your search
@@ -26,8 +26,13 @@ const items = [
|
|||||||
|
|
||||||
// Fungsi untuk fetch data equipment
|
// Fungsi untuk fetch data equipment
|
||||||
async function fetchEquipmentData(params: any) {
|
async function fetchEquipmentData(params: any) {
|
||||||
const endpoint = transform('/api/v1/equipment', params)
|
// const endpoint = transform('/api/v1/equipment', params)
|
||||||
return await xfetch(endpoint)
|
// return await xfetch(endpoint)
|
||||||
|
return await xfetch('/api/v1/material')
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchUom() {
|
||||||
|
return await xfetch('/api/v1/uom')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Menggunakan composable untuk pagination
|
// Menggunakan composable untuk pagination
|
||||||
@@ -169,10 +174,14 @@ const handleCancelConfirmation = () => {
|
|||||||
recAction.value = ''
|
recAction.value = ''
|
||||||
recItem.value = null
|
recItem.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await fetchUom()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="rounded-md border p-4">
|
<div class="p-4">
|
||||||
<Header v-model="searchInput" :prep="headerPrep" @search="handleSearch" />
|
<Header v-model="searchInput" :prep="headerPrep" @search="handleSearch" />
|
||||||
<div class="rounded-md border p-4">
|
<div class="rounded-md border p-4">
|
||||||
<AppEquipmentList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
<AppEquipmentList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export interface EquipmentMaterial {
|
||||||
|
code: string;
|
||||||
|
name: string;
|
||||||
|
uom_code: string;
|
||||||
|
stock: number;
|
||||||
|
}
|
||||||
@@ -7,9 +7,12 @@ export default defineEventHandler(async (event) => {
|
|||||||
const { method } = event.node.req
|
const { method } = event.node.req
|
||||||
const headers = getRequestHeaders(event)
|
const headers = getRequestHeaders(event)
|
||||||
const url = getRequestURL(event)
|
const url = getRequestURL(event)
|
||||||
|
const config = useRuntimeConfig()
|
||||||
|
|
||||||
|
const apiOrigin = config.API_ORIGIN || API_ORIGIN
|
||||||
const pathname = url.pathname.replace(/^\/api/, '')
|
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
|
const verificationId = headers['verification-id'] as string | undefined
|
||||||
let bearer = ''
|
let bearer = ''
|
||||||
@@ -35,6 +38,8 @@ export default defineEventHandler(async (event) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(targetUrl)
|
||||||
|
|
||||||
const res = await fetch(targetUrl, {
|
const res = await fetch(targetUrl, {
|
||||||
method,
|
method,
|
||||||
headers: forwardHeaders,
|
headers: forwardHeaders,
|
||||||
|
|||||||
Reference in New Issue
Block a user