How to use the mst-gql.localStorageMixin function in mst-gql

To help you get started, we’ve selected a few mst-gql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mobxjs / mst-gql / examples / 4-apollo-tutorial / client / src / models / RootStore.js View on Github external
},
    fetchLaunches(after) {
      return self.query(GET_LAUNCHES, after ? { after } : undefined)
    },
    clearCart() {
      self.cartItems.splice(0)
    },
    bookTrips() {
      return self.mutate(
        BOOK_TRIPS,
        { launchIds: getSnapshot(self.cartItems) },
        self.clearCart // optimistically clear the cart
      )
    }
  }))
  .extend(localStorageMixin())
github mobxjs / mst-gql / examples / 3-using-subscriptions / src / app / models / RootStore.ts View on Github external
messages: types.optional(types.map(types.late(() => Message)), {})
  })
  .actions(self => ({
    queryMessages(variables?: {  }, resultSelector = messagePrimitives, options: QueryOptions = {}) {
      return self.query(`query messages { messages {
        ${resultSelector}
      } }`, variables, options)
    },
    subscribeNewMessages(variables?: {  }, resultSelector = messagePrimitives) {
      return self.subscribe(`subscription newMessages { newMessages {
        ${resultSelector}
      } }`, variables)
    },    
  }))
 /* #endregion */
  .extend(localStorageMixin())