4.5.2 • Published 5 years ago

@sharyn/shared v4.5.2

Weekly downloads
9
License
MIT
Repository
github
Last release
5 years ago

🌹 @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.

4.5.2

5 years ago

4.5.1

5 years ago

4.5.0

5 years ago

4.4.0

5 years ago

4.3.4

5 years ago

4.3.3

5 years ago

4.3.2

5 years ago

4.3.1

5 years ago

4.3.0

5 years ago

4.2.2

5 years ago

4.2.1

5 years ago

4.2.0

5 years ago

4.2.0-alpha.0

5 years ago

4.1.0

6 years ago

4.0.3

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

4.0.0-alpha.2

6 years ago

4.0.0-alpha.1

6 years ago

4.0.0-alpha.0

6 years ago

3.4.1

6 years ago

3.4.0

6 years ago

3.3.0

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

3.0.0-alpha.0

6 years ago

2.6.1

6 years ago

2.6.0

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.0

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.9.2

6 years ago

1.9.1

6 years ago

1.9.0

6 years ago

1.8.0

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.3

6 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago