@@ -9,9 +9,6 @@ import { useNavigate } from "react-router-dom";
99import appConfig from "../../config/appConfig" ;
1010
1111export default function Gallery ( ) {
12- const baseURL = "http://127.0.0.1:8000/" ;
13- const baseurlAPI = "http://127.0.0.1:8000/api" ;
14-
1512 const navigate = useNavigate ( ) ;
1613
1714 const [ rows , setProducts ] = useState ( [ ] ) ;
@@ -32,7 +29,7 @@ export default function Gallery() {
3229 document . title = "Gallery" ;
3330 axios
3431 . get (
35- `${ baseurlAPI } /gallery?page=${ currentPage } &per_page=${ showing } &search=${ searchTerm } &showing=${ showing } `
32+ `${ appConfig . baseurlAPI } /gallery?page=${ currentPage } &per_page=${ showing } &search=${ searchTerm } &showing=${ showing } `
3633 )
3734 . then ( ( data ) => {
3835 setProducts ( data . data . data . data ) ;
@@ -150,7 +147,7 @@ export default function Gallery() {
150147 if ( ! isEditing ) {
151148 if ( validateForm ( ) ) {
152149 axios
153- . post ( `${ baseurlAPI } /gallery` , formData , {
150+ . post ( `${ appConfig . baseurlAPI } /gallery` , formData , {
154151 headers : {
155152 "Content-Type" : "multipart/form-data" ,
156153 } ,
@@ -192,11 +189,15 @@ export default function Gallery() {
192189 data . append ( "image" , formData . image ) ;
193190 data . append ( "_method" , "put" ) ;
194191 axios
195- . post ( `${ baseurlAPI } /gallery/${ modalData . id } ` , data , {
196- headers : {
197- "Content-Type" : "multipart/form-data" ,
198- } ,
199- } )
192+ . post (
193+ `${ appConfig . baseurlAPI } /gallery/${ modalData . id } ` ,
194+ data ,
195+ {
196+ headers : {
197+ "Content-Type" : "multipart/form-data" ,
198+ } ,
199+ }
200+ )
200201 . then ( ( response ) => {
201202 if ( response . status === 200 ) {
202203 Swal . fire ( {
@@ -248,7 +249,7 @@ export default function Gallery() {
248249
249250 const handleDelete = ( id ) => {
250251 axios
251- . delete ( `${ baseurlAPI } /gallery/${ id } ` )
252+ . delete ( `${ appConfig . baseurlAPI } /gallery/${ id } ` )
252253 . then ( ( data ) => {
253254 console . log ( "Success:" , data ) ;
254255 setProducts ( rows . filter ( ( row ) => row . id !== id ) ) ;
@@ -344,7 +345,7 @@ export default function Gallery() {
344345 < td >
345346 < a
346347 href = {
347- baseURL +
348+ appConfig . baseURL +
348349 "storage/images/" +
349350 row . image
350351 }
@@ -353,7 +354,7 @@ export default function Gallery() {
353354 < img
354355 className = "tw-aspect-square tw-w-4/6 tw-rounded-lg"
355356 src = {
356- baseURL +
357+ appConfig . baseURL +
357358 "storage/images/" +
358359 row . image
359360 }
0 commit comments