frontend/src/common/api.js
/**
 * Fetches the API to get information about the current user.
 *
 * If the user is logged out, field "data" will be null
 */
Fetches the API to get information about the current user.
If the user is logged out, field "data" will be null
Fetches the API to get information about the current user . If the user is logged out field " data " will be null
function useUser() {
  return useQuery(
    "user",
    () =>
      apiClient(`me`).catch((err) => {
        if (err instanceof ApiError && err.statusCode === 404) {
          return null;
        }
        throw err;
      }),
    { retry: 0 } 
  );
}
function useUser ( ) { return useQuery ( "user" , ( ) => apiClient ( ` ` ) . catch ( ( err ) => { if ( err instanceof ApiError && err . statusCode === 404 ) { return null ; } throw err ; } ) , { retry : 0 } ) ; }
Fetches the API to get information about the current user.
Fetches the API to get information about the current user .
// Only call once to avoid long wait