ganti ip http://172.17.172.17:8080
This commit is contained in:
parent
d899558e12
commit
e808f77248
@ -32,7 +32,7 @@ export default function ApprovalsPage() {
|
|||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
// Mengirim UUID booking_id ke backend Golang
|
// Mengirim UUID booking_id ke backend Golang
|
||||||
await axios.put(
|
await axios.put(
|
||||||
`http://172.17.110.6:8080/api/bookings/${bookingId}/status`,
|
`http://172.17.172.17:8080/api/bookings/${bookingId}/status`,
|
||||||
{ status: newStatus },
|
{ status: newStatus },
|
||||||
{ headers: { Authorization: `Bearer ${token}` } }
|
{ headers: { Authorization: `Bearer ${token}` } }
|
||||||
);
|
);
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export default function PowerMonitoringPage() {
|
|||||||
|
|
||||||
const fetchPowerStatus = async () => {
|
const fetchPowerStatus = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("http://172.17.110.6:8080/api/hardware/power-status");
|
const response = await fetch("http://172.17.172.17:8080/api/hardware/power-status");
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
// Asumsikan data dari HA berupa string angka, kita update ke room D101
|
// Asumsikan data dari HA berupa string angka, kita update ke room D101
|
||||||
@ -74,7 +74,7 @@ useEffect(() => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Tembak API Golang (Ganti dengan endpoint aslimu jika berbeda)
|
// Tembak API Golang (Ganti dengan endpoint aslimu jika berbeda)
|
||||||
const response = await fetch("http://172.17.110.6:8080/api/hardware/control", {
|
const response = await fetch("http://172.17.172.17:8080/api/hardware/control", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ device: backendDevice, action: actionType }),
|
body: JSON.stringify({ device: backendDevice, action: actionType }),
|
||||||
|
|||||||
@ -21,7 +21,7 @@ export default function AdminDashboard() {
|
|||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
|
|
||||||
// 1. Ambil SEMUA booking pakai endpoint yang sudah ada, lalu filter di Frontend
|
// 1. Ambil SEMUA booking pakai endpoint yang sudah ada, lalu filter di Frontend
|
||||||
const bookRes = await axios.get("http://172.17.110.6:8080/api/bookings", {
|
const bookRes = await axios.get("http://172.17.172.17:8080/api/bookings", {
|
||||||
headers: { Authorization: `Bearer ${token}` }
|
headers: { Authorization: `Bearer ${token}` }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ export default function AdminDashboard() {
|
|||||||
setPendingBookings(pendingOnly);
|
setPendingBookings(pendingOnly);
|
||||||
|
|
||||||
// 2. Ambil daftar ruangan biasa, lalu kita sisipkan "Dummy Power" untuk UI
|
// 2. Ambil daftar ruangan biasa, lalu kita sisipkan "Dummy Power" untuk UI
|
||||||
const roomRes = await axios.get("http://172.17.110.6:8080/api/rooms", {
|
const roomRes = await axios.get("http://172.17.172.17:8080/api/rooms", {
|
||||||
headers: { Authorization: `Bearer ${token}` }
|
headers: { Authorization: `Bearer ${token}` }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ export default function AdminDashboard() {
|
|||||||
try {
|
try {
|
||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
// Mengirim status 'Approved' atau 'Rejected' ke backend
|
// Mengirim status 'Approved' atau 'Rejected' ke backend
|
||||||
await axios.put(`http://172.17.110.6:8080/api/bookings/${id}/status`,
|
await axios.put(`http://172.17.172.17:8080/api/bookings/${id}/status`,
|
||||||
{ status: status },
|
{ status: status },
|
||||||
{ headers: { Authorization: `Bearer ${token}` } }
|
{ headers: { Authorization: `Bearer ${token}` } }
|
||||||
);
|
);
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export default function ManageRoomsPage() {
|
|||||||
const fetchRooms = async () => {
|
const fetchRooms = async () => {
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
const res = await axios.get("http://172.17.110.6:8080/api/rooms", {
|
const res = await axios.get("http://172.17.172.17:8080/api/rooms", {
|
||||||
headers: { Authorization: `Bearer ${token}` }
|
headers: { Authorization: `Bearer ${token}` }
|
||||||
});
|
});
|
||||||
setRooms(res.data.data);
|
setRooms(res.data.data);
|
||||||
@ -33,7 +33,7 @@ export default function ManageRoomsPage() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
await axios.put(`http://172.17.110.6:8080/api/admin/rooms/${roomId}/status`,
|
await axios.put(`http://172.17.172.17:8080/api/admin/rooms/${roomId}/status`,
|
||||||
{ status: newStatus },
|
{ status: newStatus },
|
||||||
{ headers: { Authorization: `Bearer ${token}` } }
|
{ headers: { Authorization: `Bearer ${token}` } }
|
||||||
);
|
);
|
||||||
|
|||||||
@ -19,7 +19,7 @@ export default function SchedulesPage() {
|
|||||||
const fetchSchedules = async () => {
|
const fetchSchedules = async () => {
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
const res = await axios.get("http://172.17.110.6:8080/api/schedules", {
|
const res = await axios.get("http://172.17.172.17:8080/api/schedules", {
|
||||||
headers: { Authorization: `Bearer ${token}` }
|
headers: { Authorization: `Bearer ${token}` }
|
||||||
});
|
});
|
||||||
setSchedules(res.data.data || []);
|
setSchedules(res.data.data || []);
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export default function AddBookingPage() {
|
|||||||
const fetchRooms = async () => {
|
const fetchRooms = async () => {
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
const res = await axios.get("http://172.17.110.6:8080/api/rooms", {
|
const res = await axios.get("http://172.17.172.17:8080/api/rooms", {
|
||||||
headers: { Authorization: `Bearer ${token}` },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
});
|
});
|
||||||
setRooms(res.data.data);
|
setRooms(res.data.data);
|
||||||
@ -46,7 +46,7 @@ export default function AddBookingPage() {
|
|||||||
const startISO = new Date(startTime).toISOString();
|
const startISO = new Date(startTime).toISOString();
|
||||||
const endISO = new Date(endTime).toISOString();
|
const endISO = new Date(endTime).toISOString();
|
||||||
|
|
||||||
await axios.post("http://172.17.110.6:8080/api/bookings", {
|
await axios.post("http://172.17.172.17:8080/api/bookings", {
|
||||||
room_id: parseInt(selectedRoomId),
|
room_id: parseInt(selectedRoomId),
|
||||||
start_time: startISO,
|
start_time: startISO,
|
||||||
end_time: endISO,
|
end_time: endISO,
|
||||||
|
|||||||
@ -58,9 +58,9 @@ export default function CalendarViewPage() {
|
|||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
// 2. FETCH DATA SCHEDULES BERSAMAAN DENGAN ROOMS & BOOKINGS
|
// 2. FETCH DATA SCHEDULES BERSAMAAN DENGAN ROOMS & BOOKINGS
|
||||||
const [roomsRes, bookingsRes, schedulesRes] = await Promise.all([
|
const [roomsRes, bookingsRes, schedulesRes] = await Promise.all([
|
||||||
axios.get("http://172.17.110.6:8080/api/rooms", { headers: { Authorization: `Bearer ${token}` } }),
|
axios.get("http://172.17.172.17:8080/api/rooms", { headers: { Authorization: `Bearer ${token}` } }),
|
||||||
axios.get("http://172.17.110.6:8080/api/bookings", { headers: { Authorization: `Bearer ${token}` } }),
|
axios.get("http://172.17.172.17:8080/api/bookings", { headers: { Authorization: `Bearer ${token}` } }),
|
||||||
axios.get("http://172.17.110.6:8080/api/schedules", { headers: { Authorization: `Bearer ${token}` } })
|
axios.get("http://172.17.172.17:8080/api/schedules", { headers: { Authorization: `Bearer ${token}` } })
|
||||||
]);
|
]);
|
||||||
|
|
||||||
setRooms(roomsRes.data.data || []);
|
setRooms(roomsRes.data.data || []);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user