File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed
src/components/common/Modal Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import styled from 'styled-components';
22import close from '@assets/img/close-line.png' ;
33import { useEffect , useState } from 'react' ;
44import { getMacroCode } from '@apis/api/course.ts' ;
5- import Cookies from 'js-cookie' ;
65import { useDispatch } from 'react-redux' ;
76import {
87 openModalHandler ,
@@ -19,7 +18,6 @@ function AntiMacroCodeModal() {
1918 url : '' ,
2019 answer : 0 ,
2120 } ) ;
22- const baseURL = import . meta. env . VITE_BASE_URL ;
2321 const [ inputCode , setInputCode ] = useState < number | string > ( ) ;
2422 const [ imageSrc , setImageSrc ] = useState < string > ( '' ) ;
2523
@@ -28,22 +26,12 @@ function AntiMacroCodeModal() {
2826 const fetchMacroCode = async ( ) => {
2927 try {
3028 const { data} = await getMacroCode ( ) ;
31- const response = await fetch ( `${ baseURL } ${ data . url } ` , {
32- headers : {
33- Authorization : `Bearer ${ Cookies . get ( 'accessToken' ) } ` ,
34- } ,
35- } ) ;
36- const blob = await response . blob ( ) ;
37- const url = URL . createObjectURL ( blob ) ;
38-
3929 setMacroCode ( prev => ( {
4030 ...prev ,
41- url : ` ${ baseURL } ${ data . url } ` ,
31+ url : data . url ,
4232 answer : data . answer ,
4333 } ) ) ;
44- console . log ( data ) ;
45-
46- setImageSrc ( url ) ;
34+ setImageSrc ( data . url ) ;
4735 } catch ( error ) {
4836 console . error ( '매크로 코드 불러오기 실패: ' , error ) ;
4937 }
You can’t perform that action at this time.
0 commit comments