@@ -3,6 +3,7 @@ import { Modal, Box, Typography, Button, IconButton, CircularProgress, Grid } fr
3
3
import { Close as CloseIcon } from '@mui/icons-material' ;
4
4
import { updateBoardDetailsAPI , fetchBoardsAPI } from '~/apis' ; // Ensure API is imported
5
5
import { toast } from 'react-toastify' ;
6
+ import { useNavigate } from 'react-router-dom' ;
6
7
7
8
const modalStyle = {
8
9
position : 'absolute' ,
@@ -17,16 +18,17 @@ const modalStyle = {
17
18
} ;
18
19
19
20
const predefinedBackgrounds = [
20
- { id : 1 , url : 'https://res.cloudinary .com/taskflow/image/upload/v1732968229/board-covers/ozfspo1bpuw2l5ojo3tq .jpg' } ,
21
- { id : 2 , url : 'https://res.cloudinary .com/taskflow/image/upload/v1732968519/board-covers/pxzom1gy3aotlohxe2wv .jpg' } ,
22
- { id : 3 , url : 'https://res.cloudinary .com/taskflow/image/upload/v1732969312/board-covers/uweu3wapqxynjmepoxxe .jpg' } ,
23
- { id : 4 , url : 'https://res.cloudinary .com/taskflow/image/upload/v1732969555/board-covers/mjjjeogmwmgs4yw3fk6s .jpg' } ,
21
+ { id : 1 , url : 'https://raw.githubusercontent .com/hantbk/ taskflow/main/frontend/src/assets/background/demo1 .jpg' } ,
22
+ { id : 2 , url : 'https://raw.githubusercontent .com/hantbk/ taskflow/main/frontend/src/assets/background/demo2 .jpg' } ,
23
+ { id : 3 , url : 'https://raw.githubusercontent .com/hantbk/ taskflow/main/frontend/src/assets/background/demo3 .jpg' } ,
24
+ { id : 4 , url : 'https://raw.githubusercontent .com/hantbk/ taskflow/main/frontend/src/assets/background/demo4 .jpg' } ,
24
25
] ;
25
26
26
27
function ChangeBackgroundModal ( { isOpen, handleCloseModal, board } ) {
27
28
const [ backgroundImageFile , setBackgroundImageFile ] = useState ( null ) ;
28
29
const [ loading , setLoading ] = useState ( false ) ;
29
30
const [ imagePreview , setImagePreview ] = useState ( null ) ;
31
+ const navigate = useNavigate ( ) ;
30
32
31
33
const handleFileChange = ( event ) => {
32
34
const file = event . target . files [ 0 ] ;
@@ -64,7 +66,8 @@ function ChangeBackgroundModal({ isOpen, handleCloseModal, board }) {
64
66
await updateBoardDetailsAPI ( board . _id , formData )
65
67
. then ( ( res ) => {
66
68
toast . success ( 'Background updated successfully.' ) ;
67
- window . location . reload ( ) ;
69
+ // window.location.reload();
70
+ navigate ( 0 ) ;
68
71
} ) . then ( ( ) => {
69
72
handleCloseModal ( ) ;
70
73
} )
0 commit comments