No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. dbehterev
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Groups 0

    dbehterev

    @dbehterev

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    dbehterev Follow

    Latest posts made by dbehterev

    • Need help with ssr

      Hello there. Have lack of information about proper using SSR. Only some common things from official docs. Could anybody give me some advice how to use SSR (or work code) especially in VUEX.
      First question, is how to use cookies in Vuex actions.
      For example, this code is not working (in Vuex action).

      import { LocalStorage, Cookies } from 'quasar'
      import { cookie } from 'boot/axios'
      import { i18n } from 'boot/i18n'
      
      export function configAction ({ commit, ssrContext }, locale) {
        ...
        const cookies = process.env.SERVER ? Cookies.parseSSR(ssrContext) : Cookies // otherwise we're on client
        cookie ? cookies.set('locale', locale, { expires: 365 }) : LocalStorage.set('locale', locale, { expires: 365 })
        ...
      

      I got error “cookies.set is not a function”. As I understood, you couldn’t use Cookies either LocalStorage. But how use it in SSR context?
      Or similar question, how to use cookie in Vuex state? Smth. like that:

      import { Cookies, LocalStorage } from 'quasar'
      import { cookie } from 'boot/axios'
      
      export default function (data) {
        console.log(data)
        const cookies = process.env.SERVER
          ? Cookies.parseSSR(ssrContext)
          : Cookies // otherwise we're on client
      
        return {
          user: null,
          users: [],
          token: cookie ? cookies.get('token') : LocalStorage.getItem('token'),
          cookie
        }
      }
      

      If anybody could give me any hints I’ll be grateful. Thanks.

      posted in Framework
      D
      dbehterev