Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relecture de examples/* #22

Merged
merged 5 commits into from
Oct 3, 2017
Merged

Relecture de examples/* #22

merged 5 commits into from
Oct 3, 2017

Conversation

MachinisteWeb
Copy link
Member

Tous les exemples revus

Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
@MachinisteWeb MachinisteWeb self-assigned this Oct 3, 2017
@@ -67,7 +69,8 @@ app.listen(3000)
console.log('Server is listening on http://localhost:3000')
```

And we update our `package.json` scripts:
Et nous modifions nos script dans `package.json` :
Copy link

Choose a reason for hiding this comment

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

"nos scripts"

3. We create our `SET_USER` mutation which will set the `state.authUser` to the connected user
4. We export our store instance to Nuxt.js can inject it to our main application
1. Nous importons `Vue` et `Vuex` (inclus dans Nuxt.js) et nous indiquons à Vue d'utiliser Vuex afin de pouvoir utiliser `$store` dans nos composants.
2. Nous utilisons `require('whatwg-fetch')` afin de d'obtenur un polyfill pour la méthode `fetch()` pour tous les navigateurs (consultez le [dépôt fetch](https://github.com/github/fetch)).
Copy link

Choose a reason for hiding this comment

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

"afin d'obtenir"


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))
### L'ation login()
Copy link

Choose a reason for hiding this comment

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

L'action

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

Bwarf, pas très réveillé moi aujourd'hui... Merci @rspt !

Copy link

@forresst forresst left a comment

Choose a reason for hiding this comment

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

Quelques erreurs et remarques. C'est du très bon boulot !!!

github: auth-routes
livedemo: https://nuxt-auth-routes.gomix.me
liveedit: https://gomix.com/#!/project/nuxt-auth-routes
---

# Documentation

> Nuxt.js can be used to create authenticated routes easily.
> Nuxt.js peut être utilisé pour créer des routes authentifiées facilement.
Copy link

Choose a reason for hiding this comment

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

Nuxt.js peut être utilisé pour créer facilement des routes authentifiées facilement .

@@ -48,16 +50,16 @@ app.post('/api/login', function (req, res) {
res.status(401).json({ error: 'Bad credentials' })
})

// POST /api/logout to log out the user and remove it from the req.session
// Accès à `/api/logout` en POST pour désauthentifier l'utilisateur et le retirer de `req.session`
Copy link

Choose a reason for hiding this comment

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

désauthentifier => déconnecter

Copy link
Member Author

Choose a reason for hiding this comment

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

Je mets « connecter » plus haut pour rester cohérant


We need a global state to let our application know if the user is connected **across the pages**.
Nous avons besoin d'un état global pour informer notre application si l'utilisateur est **connecté sur les pages**.
Copy link

Choose a reason for hiding this comment

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

Nous avons besoin d'un état global pour savoir si l'utilisateur est toujours connecté sur les différentes pages de notre application.

"across" dans cette phrase indique le passage d'une page à une autre, donc ne pas perdre la connexion lors du passage d'une page à l'autre. Ma proposition me parait plus en adéquation avec l'original. Ton avis ?

Copy link
Member Author

Choose a reason for hiding this comment

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

je vais mettre « reste connecté entre les pages » pour coller à across effectivement.

```bash
yarn add express express-session body-parser whatwg-fetch
```

*We will talk about `whatwg-fetch` later.*
*Nous parlerons de `whatwg-fetch` dans un instant.*
Copy link

Choose a reason for hiding this comment

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

Nous parlerons de whatwg-fetch plus tard.

"Dans un instant", cela correspond "à toute de suite" : ce n'est pas le cas

Copy link
Member Author

Choose a reason for hiding this comment

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

Ça correspond plutôt à d'ici quelque minutes. Ce qui correspond au temps moyen de lecture avant qu'on se penche sur ce truc.

Je vais mettre plus loin sous entendu « plus loin dans le texte ».


Nuxt.js will call a specific action called `nuxtServerInit` with the context in argument, so when the app will be loaded, the store will be already filled with some data we can get from the server.
Nuxt.js appelle une action spécifique nommée `nuxtServerInit` avec le contexte comme argument. Ainsi, lorsque l'application sera chargée, le store sera déjà rempli avec certaines données que nous pouvons obtenir du serveur.
Copy link

Choose a reason for hiding this comment

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

appelle => appellera

```js
login ({ commit }, { username, password }) {
return fetch('/api/login', {
// Send the client cookies to the server
// Envoyer les cookies client au serveur
Copy link

Choose a reason for hiding this comment

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

Envoyer => Envoie


```js
logout ({ commit }) {
return fetch('/api/logout', {
// Send the client cookies to the server
// Envoyer les cookies au serveur
Copy link

Choose a reason for hiding this comment

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

Envoyer => Envoie

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

@MachinisteWeb MachinisteWeb left a comment

Choose a reason for hiding this comment

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

Bien joué @forresst ! C'est surtout @rspt qui a bien bosser sur la traduction initial ! Quasiment tout est déjà traduit !

```bash
yarn add express express-session body-parser whatwg-fetch
```

*We will talk about `whatwg-fetch` later.*
*Nous parlerons de `whatwg-fetch` dans un instant.*
Copy link
Member Author

Choose a reason for hiding this comment

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

Ça correspond plutôt à d'ici quelque minutes. Ce qui correspond au temps moyen de lecture avant qu'on se penche sur ce truc.

Je vais mettre plus loin sous entendu « plus loin dans le texte ».

@@ -48,16 +50,16 @@ app.post('/api/login', function (req, res) {
res.status(401).json({ error: 'Bad credentials' })
})

// POST /api/logout to log out the user and remove it from the req.session
// Accès à `/api/logout` en POST pour désauthentifier l'utilisateur et le retirer de `req.session`
Copy link
Member Author

Choose a reason for hiding this comment

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

Je mets « connecter » plus haut pour rester cohérant


We need a global state to let our application know if the user is connected **across the pages**.
Nous avons besoin d'un état global pour informer notre application si l'utilisateur est **connecté sur les pages**.
Copy link
Member Author

Choose a reason for hiding this comment

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

je vais mettre « reste connecté entre les pages » pour coller à across effectivement.

@forresst
Copy link

forresst commented Oct 3, 2017

👏 @rspt et 👏 @haeresis

@MachinisteWeb MachinisteWeb merged commit aa5a431 into working Oct 3, 2017
@MachinisteWeb MachinisteWeb deleted the examples branch October 3, 2017 15:02
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