Giter VIP home page Giter VIP logo

Comments (5)

jskrzypek avatar jskrzypek commented on May 21, 2024 1

@ellipticaldoor I found a way around that specific problem, you currently can give specific namespaces to feathers-vuex before it clobbers your existing modules, you just need to do it in the initial call to feathers-vuex.

you can do it like this:

const feathersClient = feathers()
  .configure(hooks())
  .configure(socketio(socket))
  .configure(auth({ storage: window.localStorage }))
  .configure(rx(RxJS, {idField: '_id'}))
  .configure(feathersVuex(store, {
    idField: '_id',
    auth: {
      userService: '/users'
    }
  }, {
    'messages': { namespace: 'feathersMessagesServiceModule' },
    'users': { namespace:  'feathersUsersServiceModule' }
  }))

or to illustrate the arguments to feathersVuex better:

const feathersVuexOptions = {
  idField: '_id',
  auth: {
    userService: '/users'
  }
}

const feathersVuexModules = {
  'messages': 'feathersMessagesServiceModule', // or { namespace: 'feathersMessagesServiceModule'  },
  'users': 'feathersUsersServiceModule' // or { namespace:  'feathersUsersServiceModule' }
}

const feathersClient = feathers()
  .configure(hooks())
  .configure(socketio(socket))
  .configure(auth({ storage: window.localStorage }))
  .configure(rx(RxJS, {idField: '_id'}))
  .configure(feathersVuex(store, feathersVuexOptions, feathersVuexModules))

from feathers-vuex.

marshallswain avatar marshallswain commented on May 21, 2024 1

I've released the 1.0.0 beta, which include the ability to customize the store and fixes the "clobbering" of state, etc. Please check out the details here: #40. I'm closing this issue. Feel free to reopen after trying the new version, if needed.

from feathers-vuex.

dortamiguel avatar dortamiguel commented on May 21, 2024

Maybe feathers-vuex services can be prepended by and underscore or something like that?

Although a solution like this is not very elegant...

from feathers-vuex.

jskrzypek avatar jskrzypek commented on May 21, 2024

That's not the best because then it would make it more awkward for consumers to use in the simple example where they have no custom modules, etc.

One reason I thought about this issue was that I find the current solution with the customActions, etc added to the options passed to the service or the global modules options to be awkward and hard to maintain.

Right now to use feathers-vuex alongside existing custom modules or to integrate it with existing actions/getters/mutations/state, we have to migrate all of our existing store logic moving out of the clean structure dictated by vuex and into wherever we are calling the feathersVuex plugin.

I want to be able to manage the rest of my store as normal and then slowly add logic that exposes or integrates the actions/getters/mutations/state that feathers-vuex builds for my services.

from feathers-vuex.

dortamiguel avatar dortamiguel commented on May 21, 2024

Maybe you can rename the modules that you already have until you fully migrate to this solution.

Other problem is that you have to be careful of not naming a store module like one of your services.

from feathers-vuex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.