Skip to content

Commit

Permalink
fix: updated the rest of the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitrio-m committed Oct 30, 2024
1 parent 64521e3 commit 68d1c8c
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/content/1.getting-started/1.setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ That's it! You can now fetch data from Medusa in your Nuxt app ✨
```vue
<script setup lang="ts">
const client = useMedusaClient();
const { products } = await client.products.list();
const { products } = await client.store.product.list();
</script>
```

Expand Down
74 changes: 62 additions & 12 deletions docs/content/1.getting-started/2.options.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ Configure Nuxt Medusa easily with the `medusa` property.
export default {
// Defaults options
medusa: {
baseUrl: 'http://localhost:9000',
maxRetries: 3,
baseUrl: process.env.MEDUSA_URL || 'http://localhost:9000',
global: true,
server: false
server: false,
debug: false,
publishableKey: "",
auth: {
type: "session",
jwtTokenStorageKey: "medusa_auth_token",
jwtTokenStorageMethod: "local"
},
}
}
```

For full configuration of `@medusa/medusa-js` check out the documentation [here](https://docs.medusajs.com/js-client/overview#configuration).
For full configuration of `@medusajs/js-sdk` check out the documentation [here](https://docs.medusajs.com/resources/js-sdk).

## `baseUrl`

- Default: `http://localhost:9000`

The url to which requests are made to.

## `maxRetries`

- Default: `3`

The amount of times a request is retried.

## `global`

- Default: `true`
Expand All @@ -48,8 +48,58 @@ When set to `true` it will add a server utility `serverMedusaClient` that allows

Optional API key used for authenticating admin requests, can be done from server or `serverMedusaClient` only.

## `publishableApiKey`
## `publishableKey`

- Optional: `''`

Optional publishable API key used for storefront requests.
Required publishable API key used for storefront requests, you can generate this API key following the instructions [here](https://docs.medusajs.com/resources/storefront-development/publishable-api-keys).

## `auth.type`

- Default: `'session'`

A string that specifies the user authentication method to use.

Possible types are:

- `session`: The user is authenticated with a cookie session.
- `jwt`: The user is authenticated with a JWT token that's passed in the Bearer authorization header.

## `auth.jwtTokenStorageKey`

- Default: `'medusa_auth_token'`

A string that, when `auth.type` is `jwt`, specifies the key of the JWT token in the storage specified in the `auth.jwtTokenStorageMethod` configuration.

## `auth.jwtTokenStorageMethod`

- Default: `'local'`

A string that, when `auth.type` is `jwt`, specifies where the JWT token is stored. Possible values are:

- `local` for the Local Storage.
- `session` for the Session Storage.
- `memory` to store it within the SDK for the current application's runtime.

## `globalHeaders`

- Optional: `''`

An object of key-value pairs indicating headers to pass in all requests, where the key indicates the name of the header field.

## `debug`

- Default: `false`

A boolean indicating whether to show debug messages of requests sent in the console. This is useful during development.

## `logger`

- Default: JavaScript's console is used by default.

Replace the logger used by the JS SDK to log messages. The logger must be a class or object having the following methods:

- `error`: A function that accepts an error message to log.
- `warn`: A function that accepts a warning message to log.
- `info`: A function that accepts an info message to log.
- `debug`: A function that accepts a debug message to log.
6 changes: 3 additions & 3 deletions docs/content/2.features/1.useMedusaClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This composable uses [@medusajs/js-sdk](https://www.npmjs.com/package/@medusajs/js-sdk) under the hood and gives you access to the Medusa client.

Check the official documentation of Medusa JS Client to learn more about all the available options [here](https://docs.medusajs.com/js-client/overview/)
Check the official documentation of Medusa JS Client to learn more about all the available options [here](https://docs.medusajs.com/resources/js-sdk)

## Fetching Products

Expand All @@ -30,7 +30,7 @@ Here is an example of a fetch using the `list` method:

## Authenticating

Authenticating users with `authenticate` method:
Authenticating users with `login` method:

```vue
<script lang="ts" setup>
Expand All @@ -40,7 +40,7 @@ Authenticating users with `authenticate` method:
</script>
```

This will create a new cookie called `connect.sid` that will have a `httpOnly` flag set to true (which means that it is not accessible from the frontend JS code).
This will create a new cookie (if the authentication type is set to session) called `connect.sid` that will have a `httpOnly` flag set to true (which means that it is not accessible from the frontend JS code).

You can now fetch data about the currently logged in user as shown below:

Expand Down
2 changes: 1 addition & 1 deletion docs/content/2.features/2.serverMedusaClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This server utility is using [@medusajs/js-sdk](https://www.npmjs.com/package/@medusajs/js-sdk) under the hood and gives you access to the Medusa client.

Check the official documentation of Medusa JS Client to learn more about all the available options [here](https://docs.medusajs.com/js-client/overview/)
Check the official documentation of Medusa JS Client to learn more about all the available options [here](https://docs.medusajs.com/resources/js-sdk)

## Fetching data from Medusa on the Server

Expand Down

0 comments on commit 68d1c8c

Please sign in to comment.