Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
- Loading branch information
Showing
17 changed files
with
1,482 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
client/react-native/common/components/Forms/__generated__/ContactRequestMutation.graphql.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Environment, Network, RecordSource, Store } from 'relay-runtime' | ||
import fetch from 'isomorphic-fetch' | ||
|
||
// Define a function that fetches the results of an operation (query/mutation/etc) | ||
// and returns its results as a Promise: | ||
const fetchQuery = async (operation, variables) => { | ||
try { | ||
const response = await fetch('http://localhost:8700/graphql', { | ||
method: 'POST', | ||
headers: { | ||
// Add authentication and other headers here | ||
'content-type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
query: operation.text, // GraphQL text from input | ||
variables | ||
}) | ||
}) | ||
return response.json() | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
} | ||
|
||
// Create a network layer from the fetch function | ||
const network = Network.create(fetchQuery) | ||
const store = new Store(new RecordSource()) | ||
|
||
const environment = new Environment({ | ||
network, | ||
store | ||
// ... other options | ||
}) | ||
|
||
export default environment |
Oops, something went wrong.