Skip to content

Relecture de async-data.md#13

Merged
MachinisteWeb merged 4 commits intoworkingfrom
async-data
Sep 18, 2017
Merged

Relecture de async-data.md#13
MachinisteWeb merged 4 commits intoworkingfrom
async-data

Conversation

@MachinisteWeb
Copy link
Copy Markdown
Member

@MachinisteWeb MachinisteWeb commented Sep 16, 2017

Pensez à jeter un œil aux modifications rétroactives.

Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
1. Returning a `Promise`. Nuxt.js will wait for the promise to be resolved before rendering the component.
2. Using the [async/await proposal](https://github.com/lukehoban/ecmascript-asyncawait) ([learn more about it](https://zeit.co/blog/async-and-await))
3. Define a callback as second argument. It has to be called like this: `callback(err, data)`
1. Retourner une `Promise`. Nuxt.js attends que la promesse soit résolue avant de faire le rendu du composant.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"attend"

### Accéder aux données des routes dynamiques

You can use the context object injected into the `asyncData` property to access dynamic route data. For example, dynamic route params can be accessed using the name of the file or folder that configured it. So if you define a file named `_slug.vue`, you can acccess it via `context.params.slug`.
Vous pouvez utiliser l'objet du contexte injecté à la propriété `asyncData` afin d'accéder aux données des routes dynamiques. Par example, les données des routes dynamiques peuvent être accédées en utilisant le nom du fichier ou du dossier qui la configure. Si vous définissez un fichier nommé `_slug.vue`, vous pourrez y accéder via `context.params.slug`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Par exemple"

## Gestion des erreurs

Nuxt.js adds the `error(params)` method in the `context`, you can call it to display the error page. `params.statusCode` will be also used to render the proper status code form the server-side.
Nuxt.js ajoute la méthode `error(params)` au `context`, vous pouvez l'appeler pour afficher la page d'erreur. `params.statusCode` sera également utilisée pour faire le rendu avec le code de status approprié côté serveur.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"code de statut"

```

To customize the error page, take a look at the [VIEWS layouts section](/guide/views#layouts).
Pour personnaliser la page d'erreur, consultez la [partie mises en page de la section vues](/guide/views#mises-en-page).
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce qu'on capitaliserait le mot "vues" étant donné qu'il s'agit du nom d'une section?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Même question pour "Mises en page".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est tout a fait possible oui. Pour le moment tous les liens déjà parcouru on été rédigé sans majuscule. Pour la consistence, je préfère revoir tous les liens précédents d'un coup.

Je vais jetter un œil rétroactivement si je peux faire ça dans cette PR vu que toutes les autres sont fusionnées.

Copy link
Copy Markdown

@atinux atinux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top ! Je suis du meme avis que @rspt concernant les liens.

Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
@MachinisteWeb
Copy link
Copy Markdown
Member Author

J'ai pris tes remarques en compte @rspt. Si c'est ok pour toi, je merge !

@rspt
Copy link
Copy Markdown

rspt commented Sep 18, 2017

J'ai pris tes remarques en compte @rspt. Si c'est ok pour toi, je merge !

C'est tout bon pour moi @haeresis 👏

@MachinisteWeb MachinisteWeb merged commit 8bf7726 into working Sep 18, 2017
@MachinisteWeb MachinisteWeb deleted the async-data branch September 18, 2017 11:17
Comme vous pouvez le voir, la route nommée `users-id` contient le chemin `:id?` ce qui le rend optionnel. Si vous voulez le rendre obligatoire, créez un fichier `index.vue` dans le dossier `users/_id`.

<p class="Alert Alert--info"><b>Attention :</b> les routes dynamiques sont ignorées par la commande `generate` : [ Configuration de l'API pour la génération](/api/configuration-generate#routes)</p>
<p class="Alert Alert--info"><b>Attention :</b> les routes dynamiques sont ignorées par la commande `generate`, consultez la configuration de l'API pour La propriété `generate`](/api/configuration-generate#routes)</p>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Même question également pour les noms de section que sur la PR #14 ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cette fois c'est le bon nom de page :)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

Comme vous pouvez le voir, la route nommée `users-id` contient le chemin `:id?` ce qui le rend optionnel. Si vous voulez le rendre obligatoire, créez un fichier `index.vue` dans le dossier `users/_id`.

<p class="Alert Alert--info"><b>Attention :</b> les routes dynamiques sont ignorées par la commande `generate` : [ Configuration de l'API pour la génération](/api/configuration-generate#routes)</p>
<p class="Alert Alert--info"><b>Attention :</b> les routes dynamiques sont ignorées par la commande `generate`, consultez la configuration de l'API pour La propriété `generate`](/api/configuration-generate#routes)</p>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce qu'il ne manquerais pas un '['?

Copy link
Copy Markdown
Member Author

@MachinisteWeb MachinisteWeb Sep 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oui bien vu. J'ai commit ça : 8768bc4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants