MrMirror21

fix not resetting bug

This diff is collapsed. Click to expand it.
...@@ -10,8 +10,6 @@ require('dotenv').config(); ...@@ -10,8 +10,6 @@ require('dotenv').config();
10 10
11 const axios = require('axios'); 11 const axios = require('axios');
12 const API_KEY = process.env.REACT_APP_APIKEY; 12 const API_KEY = process.env.REACT_APP_APIKEY;
13 -console.log(API_KEY);
14 -let imageFormData = new FormData();
15 13
16 export default function Main() { 14 export default function Main() {
17 const [imgBase64, setImgBase64] = useState(""); 15 const [imgBase64, setImgBase64] = useState("");
...@@ -33,6 +31,7 @@ export default function Main() { ...@@ -33,6 +31,7 @@ export default function Main() {
33 } 31 }
34 32
35 const analysisImage = () => { 33 const analysisImage = () => {
34 + let imageFormData = new FormData();
36 imageFormData.append('file', img); 35 imageFormData.append('file', img);
37 axios({ 36 axios({
38 method: 'post', 37 method: 'post',
......
1 import React from 'react' 1 import React from 'react'
2 import { Link } from 'react-router-dom'; 2 import { Link } from 'react-router-dom';
3 +import { useSetRecoilState } from 'recoil';
3 import logo from '../style/Logo.JPG'; 4 import logo from '../style/Logo.JPG';
5 +import { selectedPosState, analysisResultState } from '../store/Global';
4 const Header = () => { 6 const Header = () => {
7 + const setPosition = useSetRecoilState(selectedPosState);
8 + const setResult = useSetRecoilState(analysisResultState);
9 + const reset = () => {
10 + setPosition('front');
11 + setResult('loading');
12 + }
5 return ( 13 return (
6 <div className="HeaderContainer" 14 <div className="HeaderContainer"
7 style={{ 15 style={{
...@@ -17,7 +25,7 @@ const Header = () => { ...@@ -17,7 +25,7 @@ const Header = () => {
17 src={logo} 25 src={logo}
18 width='100px' 26 width='100px'
19 height='100px' 27 height='100px'
20 - alt="Logo"></img> 28 + alt="Logo" onClick={reset}></img>
21 </Link> 29 </Link>
22 </div> 30 </div>
23 31
......