1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
Commit graph

25 commits

Author SHA1 Message Date
Niklas Wagner dde20fc841 Added note for AWSAppSyncClient (#4611)
I had some trouble to get server side rendering with the AWSAppSyncClient working. I finally found a solution in https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/82 but it might be worth to share it here as well. Instead of adding a big code block to each file I'll just refer to this Pull Request.

______

In case you want to use the `AWSAppSyncClient` you just need to replace the `create()` function with this function:
```jsx
import AWSAppSyncClient from 'aws-appsync';
import { AUTH_TYPE } from 'aws-appsync/lib/link/auth-link';

function create(initialState) {
  const client = new AWSAppSyncClient({
    url: AWS_AppSync.graphqlEndpoint,
    region: AWS_AppSync.region,
    auth: {
      type: AUTH_TYPE.API_KEY,
      apiKey: AWS_AppSync.apiKey,

      // Amazon Cognito Federated Identities using AWS Amplify
      //credentials: () => Auth.currentCredentials(),

      // Amazon Cognito user pools using AWS Amplify
      // type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
      // jwtToken: async () => (await Auth.currentSession()).getIdToken().getJwtToken(),
    },
    disableOffline: true,
  }, {
    cache: new InMemoryCache().restore(initialState || {}),
    ssrMode: true
  });

  return client;
}
```
2018-06-29 10:08:26 +02:00
Brice BERNARD 7e8acf3a30 [with-apollo-auth] simplify apolloState prop (#4563)
We don't need `.data` as `apollo.cache.extract()` returns at least `{}` when cache is empty
2018-06-08 11:48:10 +02:00
Brice BERNARD e318de62c0 [with-apollo-auth] Remove useless check from constructor (#4560)
We don't pass apolloClient as props, so I removed the check as confusing and always false.

see https://github.com/zeit/next.js/blob/canary/examples/with-apollo-auth/lib/withApollo.js#L72-L75

Again please explain me if I am wrong :)
2018-06-08 10:27:31 +02:00
Brice BERNARD 1a8bdba56b [with-apollo-auth] Remove useless apolloState from App's props (#4554)
App component does not need/use apolloState prop, so let's remove it. If I'm wrong please explain me the purpose of this.
2018-06-08 08:54:19 +02:00
Luis Fernando Alvarez D 2ef80a354c Fixed error with the cookie parser in with-apollo-auth (#4445)
Fixes #4442
2018-05-21 21:51:00 +02:00
Tage A. L. K 54e152b11b Minor update to with-apollo-auth (#4426)
Changes
* Update dependencies.
* Remove sending client prop to component on pages.
* Use withApollo correctly on components.
* Use `client.cache.reset()` instead of `prop.client.resetStore()`.

@adamsoffer @timneutkens
2018-05-21 12:13:56 +02:00
Luis Fernando Alvarez D 915673fcd6 Example updated: with-apollo-auth to Next 6 (#4420) 2018-05-18 10:55:12 +02:00
Yuri Yakovlev 59aa5a4dde Return empty string instead of null in the Authorization (#4389)
I was unable to make right check of `authorization` in the header on GraphQL side because now it returns `null` as string instead of empty string
2018-05-16 12:09:23 +02:00
Pascal Birchler 6b04b55354 Fix typo in next-with-apollo-auth test docs (#4328) 2018-05-10 19:02:29 +02:00
James Hegedus f2e56609cd Examples: stabalise README format and create-next-app usage (#4009)
* Examples: clarify language around Yarn create & npx

* add missing READMEs and create-next-app usage

* suggest people tag jthegedus in firebase related issues

* add yarn alt instructions

* cerebraljs example readme & fixes
2018-04-03 14:19:05 +02:00
Tage A. L. K b321e6e942 Remove deprected and refactor with-apollo-auth (#4070)
* Remove deprected use of apollo-client-preset, and refactor

Changes
* Remove deprected use of apollo-client-preset in favor of apollo-boost
* Refactor for usage of react-apollo@2.1

* Use standard

Just ran standard --fix
2018-03-31 08:11:36 +02:00
Will Meier 4570f2d050 Update with-apollo examples (#4067)
* Update with-apollo examples to include note about top-level withData HOC

* Update with-apollo examples to include note about top-level withData HOC
2018-03-28 22:30:42 +02:00
James Hegedus b1d8b839dd Examples: use npx and yarn create to run create-next-app on examples (#4002)
* remove global npm install of create-next-app

* add npx to create-next-app command in examples

* add bash to shell snippets

* add yarn create to next-app command in examples

* fix READMEs named with lowercase

* change READMEs to use UPPERCASE
2018-03-14 09:09:46 +01:00
Fumihiro Xue 972db9ba43 Fix #3814 (#3815)
* fix: module name typo

* fix: issue #3814
2018-02-16 10:49:25 +01:00
Tim Neutkens 24c1ac6ca9
Use canary for all example downloads (#3411) 2017-12-06 18:12:42 -08:00
Fouad Matin 2528779394 examples: add create-next-app (#3377)
* examples: add create-next-app

* fix with-typescript readme
2017-12-02 20:30:17 -08:00
Tage A. L. K c6d9ab7563 with-apollo-auth updated for Apollo 2.0 (#3278)
* Updated for Apollo 2.0

* Updated for commit: ccb188a

* Simplified serverState

Updated with danistefanovic's comment. Looks better.

* Revert "Simplified serverState"

This reverts commit 1b543a35909dcfe401c753cb2f71760180087057.

* Simplified server

Updated with Statedanistefanovic's comment.
2017-11-17 08:23:52 +01:00
Tim Neutkens 6977d61ebe Merge branch 'master' into canary
# Conflicts:
#	.travis.yml
2017-11-15 13:20:46 +01:00
Divyendu Singh ccb188ab6b Update withData.js - support withRouter HOC (#3286)
Add support for using withRouter as HOC with this example.

Passing router context manually fixes this, based on, https://github.com/zeit/next.js/issues/2908#issuecomment-338244804
2017-11-15 10:44:06 +01:00
Tim Neutkens 18f8ab392a Merge branch 'master' into canary
# Conflicts:
#	examples/with-apollo/lib/initApollo.js
#	examples/with-apollo/package.json
#	examples/with-react-with-styles/package.json
#	examples/with-static-export/package.json
#	package.json
2017-11-05 11:01:59 +01:00
Leonardo Quixada b41d177609 Dropped isomorphic-fetch in examples in favor of isomorphic-unfetch. (#3230) 2017-11-04 15:05:16 +01:00
Kitti Piyapan 28767c06d1 Change file name lib on example keep the same format (#3227)
Change file name format on folder lib like /examples/with-apollo and /examples/with-apollo-and-redux
2017-11-02 17:56:14 +01:00
Sergio Xalambrí fd198d28a8 Example: with absolute imports (#2863)
* Add with-absolute-imports example

* Fix examples repo urls to point to master instead of v3-beta
2017-08-30 20:03:36 +02:00
Tim Neutkens 7f2acd592b Fix download link (#2463) 2017-07-05 10:48:33 +05:30
Jess Telford 4a0278b5c0 Apollo + Authentication + graph.cool example (#2161)
* Apollo + Authentication + graph.cool example

* Fix linting errors
2017-06-30 22:18:11 +02:00