Git Product home page Git Product logo

vue-apollo-example's Introduction

vue-apollo-example

A simple vue-apollo example app

Needs apollo-server-example running.

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

vue-apollo-example's People

Contributors

akryum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-apollo-example's Issues

how to mutation?

I get a problem,I want do this:
mutation{ cancleAskOrders: cancelOrder(pairId: 1,direction: ASK){ status } cancleBidOrders: cancelOrder(pairId: 1,direction: BID){ status } }

how to do it with vue-apollo

Typescript example

It would be great if you can provide some exampe using Typescript in near future. ๐Ÿ˜„

How can I port this example for use with scaphold.io

I can't seem to grasp your use of client. In the example you are using a web socket client.
When I try to use vue-apollo with scaphold.io config, it fails with $apollo.client undefined and also shows query and mutate properties with TypeError since undefined.
What gives?

screenshot 2017-01-18 10 51 50

As you can see I experimented with trying to use localhost as ws client, then disabled on advice from @vince from scaphold.io

import ApolloClient, { createNetworkInterface } from 'apollo-client'
// import { Client } from 'subscriptions-transport-ws'
// import { addGraphQLSubscriptions } from 'vue-apollo';
import config from '../config/client'

const networkInterface = createNetworkInterface({
  uri: config.scapholdUrl,
  transportBatching: true
})

// const wsClient = new Client('ws://localhost:3001')

// const networkInterfaceWithSubscriptions = addGraphQLSubscriptions(
//   networkInterface,
//   wsClient,
// )

networkInterface.use([{
  applyMiddleware (req, next) {
    if (!req.options.headers) {
      req.options.headers = {}  // Create the header object if needed.
    }
    if (localStorage.getItem('token')) {
      req.options.headers.Authorization = `Bearer ${localStorage.getItem('token')}`
    }
    next()
  }
}])

const client = new ApolloClient({
  networkInterface // : networkInterfaceWithSubscriptions
})

// Install the vue-apollo plugin and use the apollo client
Vue.use(VueApollo, {
  client
})

new Vue({
  ...App,
  apollo: {
    // Apollo specific options
  }
}).$mount('#app')

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.