Skip to content

Instantly share code, notes, and snippets.

@laosb
Last active August 13, 2017 05:49
Show Gist options
  • Save laosb/81aba443e3ae0e535673326172eb6763 to your computer and use it in GitHub Desktop.
Save laosb/81aba443e3ae0e535673326172eb6763 to your computer and use it in GitHub Desktop.
How we connect to backend accounts system on Nuxt.js
import axios from 'axios'
export default {
components: { /* Some components */ },
beforeMount() {
//We set this on nuxtServerInit. In this way we get clientId from server.
if (this.$store.state._clientId) {
console.log('found clientId from server:', this.$store.state._clientId)
const bc = require('browser-cookies')
bc.set('__client_id', this.$store.state._clientId, { domain: 'example.com' })
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment