{props.name} |
@@ -130,12 +122,13 @@ function ResourceBookingManageCell(props) {
- {status === WAITING ? watingButton :
- status === USING ? usingButton : cancelButton
+ {status === WAITING ? watingButton :
+ status === USING ? usingButton :
+ status === BOOKED ? bookingButton :cancelButton
}
|
)
}
-export default ResourceBookingManageCell;
\ No newline at end of file
+export default ResourceBookingManageCell;
diff --git a/src/pages/manager/resourceManage/ResourceManageAdd.js b/src/pages/manager/resourceManage/ResourceManageAdd.js
index e5b2f10..ec5427e 100644
--- a/src/pages/manager/resourceManage/ResourceManageAdd.js
+++ b/src/pages/manager/resourceManage/ResourceManageAdd.js
@@ -156,7 +156,7 @@ function ResourceManageAdd(props) {
const [selectCategory, setSelectCategory] = useState("");
const [description, setDescription] = useState("");
const [imageFile, setImageFile] = useState(null);
- const [imageUrl, setImageUrl] = useState("");
+ const [imageUrl, setImageUrl] = useState(null);
const getCategories = () => {
AdminBookingResourceAxios.get(`/category`, {
@@ -199,14 +199,20 @@ function ResourceManageAdd(props) {
if (imageFile !== null) {
ImageUrlAxios.get(`?ext=${imageFile.type.split("/", 2)[1]}&dir=photo`)
.then((Response) => {
- alert(Response)
+ setImageUrl(Response.data);
+ uploadImage();
})
.catch((error) => {
console.log(error)
});
+ }else {
+ addResource()
}
}
+ const uploadImage = () => {
+ console.log(imageUrl)
+ }
const addResource = () => {
AdminBookingResourceAxios.post(``, {