56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
interface Subspesialis {
|
|
id: number;
|
|
Kode: string;
|
|
Subspesialis: string;
|
|
FK_daftar_spesialis_ID: number;
|
|
Spesialis: string;
|
|
}
|
|
|
|
export const useSubspesialisStore = defineStore("Subspesialises", () => {
|
|
const subspesialis = ref<any[]>([]);
|
|
const loadSubspesialis = async () => {
|
|
try {
|
|
subspesialis.value = await $fetch("/api/surkon/get");
|
|
} catch (error) {
|
|
console.error("Failed to load subspesialis:", error);
|
|
}
|
|
};
|
|
|
|
return {
|
|
subspesialis,
|
|
loadSubspesialis,
|
|
};
|
|
});
|
|
|
|
export const useSubspesialisStorePost = defineStore("SuratKontrol", () => {
|
|
// Create state for holding users
|
|
const surkon = ref<any[]>([]);
|
|
|
|
// Function to load user data
|
|
const loadSurKon = async (payload: Record<string, any>) => {
|
|
try {
|
|
surkon.value = await $fetch("/api/surkon/post", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify(payload)
|
|
});
|
|
} catch (error) {
|
|
console.error("Failed to load surkon:", error);
|
|
}
|
|
};
|
|
|
|
return {
|
|
surkon,
|
|
loadSurKon,
|
|
};
|
|
});
|
|
|
|
//Path:stores/users.ts
|
|
if (import.meta.hot) {
|
|
// import.meta.hot.accept(acceptHMRUpdate(useUsersStore, import.meta.hot))
|
|
import.meta.hot.accept(acceptHMRUpdate(useSubspesialisStore, import.meta.hot));
|
|
import.meta.hot.accept(acceptHMRUpdate(useSubspesialisStorePost, import.meta.hot));
|
|
}
|