minor fix

This commit is contained in:
nflnkr 2023-05-17 18:26:10 +03:00
parent a31981e82f
commit a3404a040f
2 changed files with 3 additions and 4 deletions

@ -7,9 +7,7 @@ const authUrl = process.env.NODE_ENV === "production" ? "/auth" : "https://hub.p
const makeRequest = authStore.getState().makeRequest;
export async function getOrCreateUser({ userId }: {
userId: string;
}): Promise<User | null> {
export async function getOrCreateUser(userId: string): Promise<User | null> {
return makeRequest<never, User>({
url: `${apiUrl}/${userId}`,
contentType: true,

@ -32,11 +32,12 @@ const App = () => {
useEffect(function fetchUserData() {
if (!userId) return;
getOrCreateUser({ userId }).then(result => {
getOrCreateUser(userId).then(result => {
setUser(result);
}).catch(error => {
console.log("Error fetching user", error);
enqueueSnackbar(error.response?.data?.message ?? error.message ?? "Error fetching user");
setUser(null);
});
}, [userId]);