Skip to content

Commit

Permalink
docs: correct typos for route loader (#3855)
Browse files Browse the repository at this point in the history
  • Loading branch information
wtlin1228 committed Apr 20, 2023
1 parent ab085d1 commit e6e5ab7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/docs/src/routes/docs/(qwikcity)/route-loader/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ The above example shows using `useProductData()` in two different components acr
import { component$ } from '@builder.io/qwik';
import { routeLoader$ } from '@builder.io/qwik-city';

export const useLoginStatus = routeLoader$(async ({cookie}) => {
export const useLoginStatus = routeLoader$(async ({ cookie }) => {
return {
isUserLoggedIn: checkCookie(cookie);
}
isUserLoggedIn: checkCookie(cookie),
};
});

export const useCurrentUser = routeLoader$(async ({cookie}) => {
export const useCurrentUser = routeLoader$(async ({ cookie }) => {
return {
user: currentUserFromCookie(cookie);
}
user: currentUserFromCookie(cookie),
};
});

export default component$(() => {
Expand Down Expand Up @@ -134,7 +134,7 @@ export const useProductRecommendations = routeLoader$(async (requestEvent) => {

## Access the `routeLoader$` data within another `routeLoader$`

You can to access the data from one `routeLoader$` inside another `routeLoader$` using the `requestEvent.resolveValue` method.
You can access the data from one `routeLoader$` inside another `routeLoader$` using the `requestEvent.resolveValue` method.

```tsx /requestEvent/ title="src/routes/product/[productId]/index.tsx"
import { routeLoader$ } from '@builder.io/qwik-city';
Expand Down Expand Up @@ -168,6 +168,7 @@ In addition, the `fail` function allows `routeLoader$` to override the HTTP stat
This is useful when the loader needs to return a "error" value that is not `undefined`, but it also needs to indicate that the data failed to load.

```tsx /requestEvent.fail/ /errorMessage/#a title="src/routes/product/[productId]/index.tsx"
import { component$ } from '@builder.io/qwik';
import { routeLoader$ } from '@builder.io/qwik-city';

export const useProductDetails = routeLoader$(async (requestEvent) => {
Expand Down

0 comments on commit e6e5ab7

Please sign in to comment.