Skip to content

Commit f32beb7

Browse files
committed
Improve error message, use != null instead of undefined
1 parent 9f24eca commit f32beb7

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/Dashboard.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,11 @@ function Dashboard() {
107107
</div>
108108
) : userProgress == null ? (
109109
<div className="text-center">
110-
<p className="mb-4 text-red-700">
111-
No progress repository found for <strong>{username}</strong>. Ensure that you have enabled remote progress tracking in the Git-Mastery app.
110+
<p className="mb-2 text-red-700">
111+
No progress repository found for <strong>{username}</strong>.
112+
</p>
113+
<p className="mb-6 text-red-700">
114+
Ensure that you have enabled remote progress tracking using <code className="bg-gray-100 px-2 py-1">gitmastery progress sync on</code> in the Git-Mastery app.
112115
</p>
113116
<Link
114117
to="/"

src/api/queries/get_user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const useGetUserQuery = (username: string | undefined) => {
1919
return useQuery<User | null>({
2020
queryKey: ["get-user", username],
2121
queryFn: () => getUser(username!),
22-
enabled: username != undefined,
22+
enabled: username != null,
2323
})
2424
}
2525

src/api/queries/get_user_progress.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface UserProgress {
99
export const getUserProgress = async (username: string) => {
1010
try {
1111
const encodedUsername = encodeURIComponent(username);
12+
console.log(encodedUsername);
1213
const result = await axios.get<UserProgress[]>(`https://raw.githubusercontent.com/${encodedUsername}/${encodedUsername}-gitmastery-progress/refs/heads/main/progress.json`);
1314
return result.data;
1415
} catch {
@@ -20,7 +21,7 @@ export const useGetUserProgressQuery = (username: string | undefined) => {
2021
return useQuery<UserProgress[] | null>({
2122
queryKey: ["get-user-progress", username],
2223
queryFn: () => getUserProgress(username!),
23-
enabled: username != undefined,
24+
enabled: username != null,
2425
});
2526
}
2627

0 commit comments

Comments
 (0)