Add component

This commit is contained in:
2025-09-17 12:17:14 +07:00
parent b25aaf124c
commit 4a3ae20b84
19 changed files with 2074 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import axios from 'axios';
const RegistrationRequest = async ({ method, prefix, params, headers = {} }) => {
const baseURL = `${import.meta.env.VITE_API_SERVER}`;
try {
const response = await axios({
method: method,
url: `${baseURL}/${prefix}`,
data: params,
headers: {
'Accept-Language': 'en_US',
...headers,
},
withCredentials: true,
});
return response.data || {};
} catch (error) {
console.error(`Error saat ${prefix}:`, error.response?.data || error.message);
throw error.response?.data || { message: 'Terjadi kesalahan pada server' };
}
};
export default RegistrationRequest;