Skip to content

Commit

Permalink
Merge pull request #103 from Review-zip/fix-error
Browse files Browse the repository at this point in the history
Fix: error
  • Loading branch information
gkqkehs7 authored Feb 20, 2024
2 parents 7438b29 + d12e92f commit 16aa2c4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const styles = {
max-height: 6vh;
color: white;
font-weight: bold;
text-align: left;
`,

HashTagContainer: styled.div`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const styles = {

Image: styled.img`
width: 100%;
max-height: 460px;
object-fit: cover;
`,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ const styles = {
background-color: white;
padding: 5px;
border: none;
color: black;
&:focus {
outline: none;
Expand Down
42 changes: 24 additions & 18 deletions src/pages/myProfilePage/myProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ const MyProfilePage: React.FC = () => {
);

setPosts(response.data.result);
}, []);
}, [userId]);

// 스크랩한 게시글들 가져오기
const getScrabPosts = useCallback(async () => {
const response = await GetAxiosInstance<GetUserPostsResponse>(
`/v1/users/${userId}/posts/scrabs`,
);
setScrabPosts(response.data.result);
}, []);
}, [userId]);

// 유저들의 정보(닉네임, 프로필 이미지 등) 가져오기
const getUserInfo = useCallback(async () => {
Expand Down Expand Up @@ -130,23 +130,29 @@ const MyProfilePage: React.FC = () => {
}, [userId]);

// 팔로우 하기
const followUser = async (user: User) => {
setUserInfo({ ...user, following: true });
try {
await PostAxiosInstance(`/v1/follows/users/${userId}`);
} catch (error) {
setUserInfo({ ...user, following: false });
}
};

const unFollowUser = async (user: User) => {
setUserInfo({ ...user, following: false });
try {
await DeleteAxiosInstance(`/v1/follows/users/${userId}`);
} catch (error) {
const followUser = useCallback(
async (user: User) => {
setUserInfo({ ...user, following: true });
}
};
try {
await PostAxiosInstance(`/v1/follows/users/${userId}`);
} catch (error) {
setUserInfo({ ...user, following: false });
}
},
[userInfo],
);

const unFollowUser = useCallback(
async (user: User) => {
setUserInfo({ ...user, following: false });
try {
await DeleteAxiosInstance(`/v1/follows/users/${userId}`);
} catch (error) {
setUserInfo({ ...user, following: true });
}
},
[userInfo],
);

const editProfile = async () => {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/notFoundPage/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const styles = {
display: flex;
width: 100vw;
height: 100vh;
over-flow: hidden;
overflow: hidden;
`,
Left: styled.div`
flex: 1;
Expand Down

0 comments on commit 16aa2c4

Please sign in to comment.