aboutsummaryrefslogtreecommitdiff
path: root/src/hooks/APIClient.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/hooks/APIClient.ts')
-rw-r--r--src/hooks/APIClient.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hooks/APIClient.ts b/src/hooks/APIClient.ts
index ce11134..7f7d170 100644
--- a/src/hooks/APIClient.ts
+++ b/src/hooks/APIClient.ts
@@ -9,9 +9,9 @@ const arrayOptions = {
revalidateOnMount: true
};
-export const useUser = (username: string) => {
+export const useUser = (username: string | null) => {
return useSWR(
- `/users?username=${username}`,
+ username && `/users?username=${username}`,
(url: string) => get(url).then(response => response.data[0])
);
};
@@ -21,5 +21,5 @@ export const useProfile = (id: string) => {
};
export const useFeed = () => {
- return useSWR(`/feed`, fetcher, arrayOptions);
+ return useSWR('/feed', fetcher, arrayOptions);
};