From 60f26b4a272fe518e0511e9060d6aa5176210f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Huertas?= <123009293+huertin03@users.noreply.github.com> Date: Mon, 15 May 2023 19:33:29 +0200 Subject: [PATCH] Update FollowClient.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added '../' to the fetch directories, otherwise wouldn´t be possible to redirect to de follow api --- components/FollowButton/FollowClient.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/FollowButton/FollowClient.tsx b/components/FollowButton/FollowClient.tsx index 73f0420..a539b6d 100644 --- a/components/FollowButton/FollowClient.tsx +++ b/components/FollowButton/FollowClient.tsx @@ -16,7 +16,7 @@ export default function FollowClient({ targetUserId, isFollowing }: Props) { const follow = async () => { setIsFetching(true); - const res = await fetch('/api/follow', { + const res = await fetch('../api/follow', { method: 'POST', body: JSON.stringify({ targetUserId }), headers: { @@ -43,7 +43,7 @@ export default function FollowClient({ targetUserId, isFollowing }: Props) { const unfollow = async () => { setIsFetching(true); - const res = await fetch(`/api/follow?targetUserId=${targetUserId}`, { + const res = await fetch(`../api/follow?targetUserId=${targetUserId}`, { method: 'DELETE', }); @@ -67,4 +67,4 @@ export default function FollowClient({ targetUserId, isFollowing }: Props) { } -} \ No newline at end of file +}