Skip to content

Commit

Permalink
Merge pull request #56 from TABA-4th/dev
Browse files Browse the repository at this point in the history
merge dev branch
  • Loading branch information
kjungw1025 authored Dec 1, 2023
2 parents d4ca8a9 + 4394314 commit 00dd016
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
9 changes: 7 additions & 2 deletions src/views/examples/FileUploaderPage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {useState} from 'react';
import axios from 'axios';
import FileUpload from 'components/Functions/FileUpload';
import { useNavigate } from 'react-router-dom';

// reactstrap components
import {
Expand All @@ -15,6 +16,9 @@ import DefaultFooter from "components/Footers/DefaultFooter.js";

function FileUploaderPage() {

// 페이지 이동을 위한 navigate
const navigate = useNavigate();

const [URLThumbnail, setURLThumbnail] = useState();

const createImageURL = (fileBlob) => { // createObjectURL 방식
Expand All @@ -33,13 +37,13 @@ function FileUploaderPage() {
const uploadImage = files[0];
let nickname = sessionStorage.getItem('nickname');


createImageURL(uploadImage);

if (uploadImage) {

let formData = new FormData();
formData.append('file', uploadImage);
formData.append('nickname', 'yourNickname');
formData.append('nickname', nickname);

axios({
method:'post',
Expand All @@ -52,6 +56,7 @@ function FileUploaderPage() {
.then(function(response){
// 업로드 성공 시 실행할 코드
console.log('이미지 업로드 성공');
navigate(`/result`);
})
.catch(function(error){
// 업로드 실패 시 실행할 코드
Expand Down
34 changes: 18 additions & 16 deletions src/views/examples/ResultPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@ import DefaultFooter from "components/Footers/DefaultFooter.js";

function ResultPage () {

React.useEffect(() => {
document.body.classList.add("landing-page");
document.body.classList.add("sidebar-collapse");
document.documentElement.classList.remove("nav-open");
window.scrollTo(0, 0);
document.body.scrollTop = 0;
return function cleanup() {
document.body.classList.remove("landing-page");
document.body.classList.remove("sidebar-collapse");
};
}, []);


React.useEffect(() => {
document.body.classList.add("landing-page");
document.body.classList.add("sidebar-collapse");
document.documentElement.classList.remove("nav-open");
window.scrollTo(0, 0);
document.body.scrollTop = 0;
return function cleanup() {
document.body.classList.remove("landing-page");
document.body.classList.remove("sidebar-collapse");
};
}, []);

// 세션 스토리지에서 nickname 가져오기
const nickname = sessionStorage.getItem('nickname');

return (
<>
<IndexNavbar />
Expand All @@ -38,9 +40,9 @@ function ResultPage () {
<Container className="mx-auto" >
<Row>
<Col className="ml-auto mr-auto text-center" md="10">
<h1 className="title">ooo님의 두피 검사 결과입니다! </h1>
<br /><br /><br /><br />
<h2 className="title">{nickname}님의 두피 검사 결과입니다! </h2>

<br /><br /><br /><br />
</Col>
</Row>
</Container>
Expand Down

0 comments on commit 00dd016

Please sign in to comment.