Add:
- lib/api.ts

### No Issue
This commit is contained in:
2025-08-15 17:39:32 +08:00
parent 4f4d9b2f05
commit 6f5d04e73f
5 changed files with 86 additions and 15 deletions

23
lib/api.ts Normal file
View File

@@ -0,0 +1,23 @@
const API_BASE = (path: string) => {
const url = "https://stg-hipmi.wibudev.com/";
// const url = "http://10.169.174.254:3000/";
return `${url}/${path}`;
};
export async function apiVersion() {
const response = await fetch(API_BASE("api/version"));
const data = await response.json();
return data;
}
export async function apiLogin({ nomor }: { nomor: string }) {
const response = await fetch(API_BASE("api/auth/login"), {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ nomor: nomor }),
});
const data = await response.json();
return data;
}