Skip to content

Commit

Permalink
Merge pull request #72 from jaeyo03/develop
Browse files Browse the repository at this point in the history
좋아요 기능 수정
  • Loading branch information
jaeyo03 authored Nov 7, 2024
2 parents dee3b54 + f5ce09c commit bed5064
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions src/components/Album/ImageCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ function ImageCard({ id, isEditing, isSelected, onClick, photoUrl, isLiked }: Im
const [like, setLike] = useState(isLiked);
const { accessToken } = useAuthStore();

const likePhotos = async (albumId:number, accessToken:string) => {
const likePhotos = async (albumId: number, accessToken: string) => {
try {
const res = await Post(`/api/v1/album/like/${albumId}`, {
headers: {
Authorization: `Bearer ${accessToken}`,
},
});
if(res.status === 200){
const res = await Post(
`/api/v1/album/like/${albumId}`,
null,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
}
);
if (res.status === 200) {
console.log(res.data.payload);
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Album/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function Album() {
try {
const res = await Post(
`/api/v1/album/like/${albumId}`,
{},
null,
{
headers: {
Authorization: `Bearer ${accessToken}`,
Expand Down

0 comments on commit bed5064

Please sign in to comment.