Initial commit: Retribusi frontend dengan dashboard, event logs, dan settings
This commit is contained in:
80
public/dashboard/js/README_CONFIG.md
Normal file
80
public/dashboard/js/README_CONFIG.md
Normal file
@@ -0,0 +1,80 @@
|
||||
# Konfigurasi API Base URL
|
||||
|
||||
## Lokasi File
|
||||
- **Config**: `public/dashboard/js/config.js`
|
||||
- **Digunakan oleh**: `api.js`, `realtime.js`
|
||||
|
||||
## Cara Kerja
|
||||
|
||||
File `config.js` akan auto-detect environment berdasarkan hostname:
|
||||
|
||||
### Development Lokal
|
||||
- Jika hostname = `localhost`, `127.0.0.1`, atau IP lokal (`192.168.x.x`)
|
||||
- Base URL default: `http://localhost/api-btekno/public`
|
||||
- **Sesuaikan** dengan path API backend di Laragon/XAMPP Anda
|
||||
|
||||
### Production
|
||||
- Jika hostname bukan localhost
|
||||
- Base URL: `https://api.btekno.cloud`
|
||||
|
||||
## Cara Mengubah Base URL
|
||||
|
||||
### Opsi 1: Edit `config.js` (Recommended)
|
||||
Edit file `public/dashboard/js/config.js`:
|
||||
|
||||
```javascript
|
||||
function getApiBaseUrl() {
|
||||
const hostname = window.location.hostname;
|
||||
|
||||
// Development lokal
|
||||
if (hostname === 'localhost' || hostname === '127.0.0.1') {
|
||||
// GANTI INI sesuai path API backend Anda
|
||||
return 'http://localhost/api-btekno/public';
|
||||
// Atau jika pakai virtual host:
|
||||
// return 'http://api.retribusi.test';
|
||||
}
|
||||
|
||||
// Production
|
||||
return 'https://api.btekno.cloud';
|
||||
}
|
||||
```
|
||||
|
||||
### Opsi 2: Hardcode (Tidak Recommended)
|
||||
Jika ingin hardcode, edit langsung di `config.js`:
|
||||
|
||||
```javascript
|
||||
export const API_CONFIG = {
|
||||
BASE_URL: 'http://localhost/api-btekno/public', // Ganti ini
|
||||
API_KEY: 'POKOKEIKISEKOYOLO',
|
||||
TIMEOUT: 30000
|
||||
};
|
||||
```
|
||||
|
||||
## Contoh Path API Backend
|
||||
|
||||
### Laragon
|
||||
- Jika API di: `C:\laragon\www\RETRIBUSI_BAPENDA\api-btekno\public`
|
||||
- Base URL: `http://localhost/api-btekno/public`
|
||||
- Atau buat virtual host: `http://api.retribusi.test`
|
||||
|
||||
### XAMPP
|
||||
- Jika API di: `C:\xampp\htdocs\api-btekno\public`
|
||||
- Base URL: `http://localhost/api-btekno/public`
|
||||
|
||||
### Production
|
||||
- Base URL: `https://api.btekno.cloud`
|
||||
|
||||
## API Key
|
||||
|
||||
API Key juga bisa diubah di `config.js`:
|
||||
```javascript
|
||||
API_KEY: 'POKOKEIKISEKOYOLO' // Sesuaikan dengan RETRIBUSI_API_KEY di backend .env
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
Untuk melihat Base URL yang digunakan, buka browser console. Akan muncul log:
|
||||
```
|
||||
API Base URL: http://localhost/api-btekno/public
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user