Skip to content

Commit

Permalink
Merge pull request #112 from Outfit-of-the-Trip/fix/#108
Browse files Browse the repository at this point in the history
Minor Changes
  • Loading branch information
aest3ra authored Oct 14, 2023
2 parents 4377126 + c9d2bbb commit e6ff9ee
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/screens/MypageScreen/MypageScreen.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React, {useContext, useEffect, useState} from 'react';
import React, { useContext, useEffect, useState } from 'react';

import {useNavigation} from '@react-navigation/native';
import {launchImageLibrary, launchCamera} from 'react-native-image-picker';
import {TabView, TabBar} from 'react-native-tab-view';
import { useNavigation, useIsFocused } from '@react-navigation/native';
import { launchImageLibrary, launchCamera } from 'react-native-image-picker';
import { TabView, TabBar } from 'react-native-tab-view';
import { useRecoilValue } from 'recoil';
import { userInfoState } from '../../states/atoms';
import axios from 'axios';
import {AuthContext} from '../../utils/Auth';
import { AuthContext } from '../../utils/Auth';
import { backendURL } from '../../constants/url';

import axios from 'axios';

import {
Pressable,
HamburgerIcon,
Expand Down Expand Up @@ -38,6 +39,14 @@ import {

const MypageScreen = () => {

const isFocused = useIsFocused();

useEffect(() =>{
if(isFocused) {
getPictureFromDB()
}
}, [isFocused])

const {logout} = useContext(AuthContext);
const userInfo = useRecoilValue(userInfoState);

Expand All @@ -54,7 +63,6 @@ const MypageScreen = () => {
const [index, setIndex] = useState(0);
const [modalVisible, setModalVisible] = useState(false);
const [userStyles, setUserStyles] = useState();
const [getClothesData, setGetClothesData] = useState();
const [postData, setPostData] = useState();

const [data, setData] = useState({});
Expand Down Expand Up @@ -110,7 +118,6 @@ const MypageScreen = () => {
} else if (response.error) {
console.log('Image picker error: ', response.error);
} else {
const ImgUri = response.assets[0].uri;
const base = response.assets[0];

try {
Expand Down Expand Up @@ -152,7 +159,11 @@ const MypageScreen = () => {
const getPictureFromDB = async () => {
try {
await axios.get(backendURL+`/api/closet/getClosetData?userId=${userInfo.nickname}`)
.then((res)=>{setClothesData(res.data)})
.then((res)=>{
setClothesData(res.data)
setPostData(0)
setIndex(0)
})
}
catch (e) {
console.log(e);
Expand Down Expand Up @@ -283,7 +294,6 @@ const MypageScreen = () => {
indicatorStyle={styles.listunderline}
style={styles.listBackground}
labelStyle={styles.listTitle}
// onTabPress={getPictureFromDB}
/>
)}
/>
Expand Down

0 comments on commit e6ff9ee

Please sign in to comment.