Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit f770c3b

Browse files
committed
feat: integrate Redux for fetching board details after background update
1 parent 97100de commit f770c3b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

frontend/src/components/AppBar/ChangeBackgroundModal.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Close as CloseIcon } from '@mui/icons-material';
44
import { updateBoardDetailsAPI, fetchBoardsAPI } from '~/apis'; // Ensure API is imported
55
import { toast } from 'react-toastify';
66
import { useNavigate } from 'react-router-dom';
7+
import { useDispatch } from 'react-redux'; // Import useDispatch to dispatch actions
8+
import { fetchBoardDetailsAPI } from '~/redux/activeBoard/activeBoardSlice'; // Import action to fetch board details
79

810
const modalStyle = {
911
position: 'absolute',
@@ -29,6 +31,7 @@ function ChangeBackgroundModal({ isOpen, handleCloseModal, board }) {
2931
const [loading, setLoading] = useState(false);
3032
const [imagePreview, setImagePreview] = useState(null);
3133
const navigate = useNavigate();
34+
const dispatch = useDispatch()
3235

3336
const handleFileChange = (event) => {
3437
const file = event.target.files[0];
@@ -67,8 +70,9 @@ function ChangeBackgroundModal({ isOpen, handleCloseModal, board }) {
6770
.then((res) => {
6871
toast.success('Background updated successfully.');
6972
// window.location.reload();
70-
navigate(0);
73+
// navigate(0);
7174
}).then(() => {
75+
dispatch(fetchBoardDetailsAPI(board._id));
7276
handleCloseModal();
7377
})
7478
.catch((error) => {

0 commit comments

Comments
 (0)