@sharyn/shared
[![npm](https://img.shields.io/npm/v/@sharyn/shared.svg)](https://www.npmjs.com/package/@sharyn/shared)
Last updated 12 days ago by sharyn .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @sharyn/shared 
SYNC missed versions from official npm registry.

???? @sharyn/shared

npm

This package provides isomorphic / universal utilities than can be used on both the client and the server.

???? Install

yarn add @sharyn/shared

???? Usage

Switch

import Switch from '@sharyn/shared/Switch'
import FooPage from 'foo/cmp-page/foo-page'
import FooIcon from '@material-ui/icons/Foo'

export const fooRoute: Object = {
  path: '/foo',
  exact: true,
  loggedInOnly: true,
  title: 'Foo',
  Icon: FooIcon,
  inNav: true,
}

const routesAndCmps = [
  { route: fooRoute, component: FooPage }
  { route: barRoute, component: BarPage }
]

const App = () => (
  <Switch routesAndCmps={routesAndCmps} />
)

fetchGraphql (don't use it)

// ...

const query = "query ($id: ID!) { getThing(id: $id) { id } }"
const variables = { id: 123 }

const resp = await fetchGraphql({ query, variables })

/*
  {
    data: {
      getThing: { id: 123 }
    },
    errors: [...]
  }
*/

Options

fetchGraphql(options, fetchOptions)

  • options is an object than can contain:

    • query (required): The GraphQL query.
    • variables: The object of your variables.
    • host: The host (https://www.example.com:12345). Leave this field empty for client-side fetches.
    • path: The GraphQL path (default is /graphql)
    • cookie: A cookie string (useful for server-side fetches).
  • fetchOptions is the native options of fetch in case you need to override the defaults provided by fetchGraphql.

Current Tags

  • 4.5.2                                ...           latest (12 days ago)

66 Versions

  • 4.5.2                                ...           12 days ago
  • 4.5.1                                ...           22 days ago
  • 4.5.0                                ...           a month ago
  • 4.4.0                                ...           2 months ago
  • 4.3.4                                ...           2 months ago
  • 4.3.3                                ...           2 months ago
  • 4.3.2                                ...           3 months ago
  • 4.3.1                                ...           4 months ago
  • 4.3.0                                ...           4 months ago
  • 4.2.2                                ...           4 months ago
  • 4.2.1                                ...           9 months ago
  • 4.2.0                                ...           9 months ago
  • 4.2.0-alpha.0                                ...           9 months ago
  • 4.1.0                                ...           10 months ago
  • 4.0.3                                ...           10 months ago
  • 4.0.1                                ...           10 months ago
  • 4.0.0                                ...           10 months ago
  • 4.0.0-alpha.2                                ...           a year ago
  • 4.0.0-alpha.1                                ...           a year ago
  • 4.0.0-alpha.0                                ...           a year ago
  • 3.4.1                                ...           a year ago
  • 3.4.0                                ...           a year ago
  • 3.3.0                                ...           a year ago
  • 3.2.0                                ...           a year ago
  • 3.1.0                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 3.0.0-alpha.0                                ...           a year ago
  • 2.6.1                                ...           a year ago
  • 2.6.0                                ...           a year ago
  • 2.5.1                                ...           a year ago
  • 2.5.0                                ...           a year ago
  • 2.4.0                                ...           a year ago
  • 2.3.0                                ...           a year ago
  • 2.2.0                                ...           a year ago
  • 2.1.1                                ...           a year ago
  • 2.1.0                                ...           a year ago
  • 2.0.3                                ...           a year ago
  • 2.0.2                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.9.2                                ...           a year ago
  • 1.9.1                                ...           a year ago
  • 1.9.0                                ...           a year ago
  • 1.8.0                                ...           a year ago
  • 1.7.1                                ...           a year ago
  • 1.7.0                                ...           a year ago
  • 1.6.3                                ...           a year ago
  • 1.6.2                                ...           a year ago
  • 1.6.1                                ...           a year ago
  • 1.6.0                                ...           a year ago
  • 1.5.2                                ...           a year ago
  • 1.5.1                                ...           a year ago
  • 1.5.0                                ...           a year ago
  • 1.4.0                                ...           a year ago
  • 1.3.2                                ...           a year ago
  • 1.3.1                                ...           a year ago
  • 1.3.0                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 0.2.1                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 36
Last Day 0
Last Week 0
Last Month 180
Dependencies (5)
Dev Dependencies (0)
None

Copyright 2014 - 2017 © taobao.org |