Commit graph

48 commits

Author SHA1 Message Date
Henrik Wenz
cf4fdaf4f2 Remove _app.js from with-apollo-auth example (#8556)
* Move apollo logic into one file

+ Use http-link from http boost

* Remove _app.js from with-apollo-auth example

* Covert other class components to functional components

* Use esm import instead of require
2019-09-02 16:10:53 -05:00
Lukas Strassel
83a10eefee add cookie path property (#8594)
played around with that example and was wondering why it didn't work any more when having an `auth/login` page.

I hope this addition will spare someone else some confusion :)
2019-09-02 13:30:29 -05:00
Henrik Wenz
a9325f123a Remove prefetch attributes from examples (#8481)
* Remove prefetch from with-apollo-and-redux-saga example

Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: https://err.sh/zeit/next.js/prefetch-true-deprecated

* Remove prefetch from using-inferno example

Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: https://err.sh/zeit/next.js/prefetch-true-deprecated

* Remove prefetch from with-apollo-and-redux example

Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: https://err.sh/zeit/next.js/prefetch-true-deprecated

* Remove prefetch from with-apollo-auth example

Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: https://err.sh/zeit/next.js/prefetch-true-deprecated

* Remove prefetch from with-tailwindcss example

Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: https://err.sh/zeit/next.js/prefetch-true-deprecated

* Remove prefetch from with-graphql-hooks example

Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: https://err.sh/zeit/next.js/prefetch-true-deprecated

* Remove prefetch from data-fetch example

Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: https://err.sh/zeit/next.js/prefetch-true-deprecated
2019-08-23 10:12:25 -04:00
Stanislav Morozevich
718e577169 Update with-apollo-auth example (#8416)
* Provide default value for apolloState

* Use hooks api

* Fix formatting problems

* Use useRef hook

* Add simple comment about displayName

* Go with caret for react-hooks and react-ssr
2019-08-19 23:49:24 -04:00
Tim Neutkens
a90a55545b
Deprecate Container usage (#8327)
* Remove Container from examples

* Update readme to reflect Container removal
2019-08-11 22:02:33 +02:00
JJ Kasper
dc9e270898
Update examples for Apollo with AppTree (#8180)
* Update examples for Apollo with AppTree

* Fix apolloClient being overwritten when rendering AppTree
2019-07-31 16:07:14 -04:00
Joe Haddad
c03e94bebd
Remove usage of process.browser (#7651) 2019-06-24 16:34:10 -04:00
Joe Haddad
c7276bcbef
Run lint-fix 2019-05-28 16:06:13 -07:00
Matthew Sweeney
0cd2732c7f
Remove deploy to now button from all examples (#7101) 2019-05-27 12:22:05 -07:00
nabiltntn
4f49f0844f With apollo auth proxy (#7165)
* Added optional fetch agent to with-apollo-auth
2019-05-06 16:46:44 -05:00
Connor Davis
3fa04620e7 Remove Deploy To Now buttons (#7126)
* Remove Deploy To Now buttons

* Remove remaining buttons
2019-04-24 10:53:58 +02:00
Juan Olvera
7e12997af6 Test updater script on examples folder (#5993)
I wrote a [script](https://github.com/j0lv3r4/dependency-version-updater) to update dependencies recursively in `package.json` files, e.g.:

```
$ node index.js --path="./examples" --dependencies="react=^16.7.0,react-dom=^16.7.0"
```

This PR contains the result against the examples folder.
2019-01-05 12:19:27 +01:00
Tim Neutkens
9c4eefcdbf
Add prettier for examples directory (#5909)
* Add prettier for examples directory

* Fix files

* Fix linting

* Add prettier script in case it has to be ran again
2018-12-17 17:34:32 +01:00
Anderson Leite
48d3ae2dd6 Remove unused vars and fix typo. (#5752)
- Removed unused "render" and "appPort" var from tests
- Fix typo on "occured" to "occurred"
2018-11-27 12:28:34 +01:00
paulogdm
e5d8eb2374 Update README.md (#5698)
Fixes #5680
2018-11-18 20:45:22 +01:00
Janek Rahrt
a7b6ffa914 Fix ssr auth bug and dependency problems (#5543)
* fix graphql dep

* fix ssr auth bug

* fix linting issues
2018-10-28 13:13:28 -07:00
Zach Curtis
829f4e581c Fixed auth token not getting refreshed on client cache reset (#5471) 2018-10-17 16:52:29 +02:00
Tim Neutkens
b6c8d2a4ac Merge branch 'canary'
# Conflicts:
#	package.json
2018-09-19 18:15:57 +02:00
Marcelo Zapaia
ae7e53239a FIX with-apollo-auth example token access (#4771)
in some cases access to the token doesn't work in client side. this access to the token once in getInitialProps method and pass it down using props
2018-09-12 17:19:32 +02:00
Keith Grennan
8f61c335cb [with-apollo-auth] Only run getDataFromTree() on server (fix #4775) (#5112)
Though it sounds like some folks do run getDataFromTree() on the client in order to avoid loading states, it's non-standard usage and potentially confusing.  Also it's inconsistent with the other with-apollo examples.
2018-09-06 09:45:16 +02:00
HaNdTriX
5ff7c0742c Lint examples (#4985)
* Lint examples/with-apollo-and-redux-saga

* Lint examples/with-apollo-auth

* Lint examples/with-apollo

* Lint exampels/with-google-analytics

* Lint examples/with-higher-order-component

* Lint examples/with-react-i18next

* Lint exampels/with-redux

* Lint exampels/with-relay-modern

* Lint examples/with-universal-configuration-runtime

* Add **/examples/**/lib/** to linter
2018-08-20 08:31:24 +02:00
Tim Phillips
b990b29d2d Update Apollo links in examples (#4933) 2018-08-09 14:00:08 -07:00
Michael Herold
5b3578e58f #4751 - Explicitly mention install when cloning examples (#4758)
Preferably this installation wouldn't be necessary, but in lieu of a fix...

#4751
2018-07-11 23:56:15 +02:00
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