-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: finish implementation. Missing ast generation
- Loading branch information
1 parent
c73dcb3
commit d2d1fa8
Showing
9 changed files
with
77 additions
and
53 deletions.
There are no files selected for viewing
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
title: Aborting requests in React Native | ||
date: 2019-04-14 11:11:30 | ||
description: How can we close an active connection initiated with Fetch? And most important, what do we mean by "closing a connection"? | ||
image: "./closed-connection.jpg" | ||
imageAlt: market closed sign | ||
slug: blog/aborting-fetch-react-native | ||
draft: false | ||
--- | ||
|
||
test2 |
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
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const { gql } = require("graphql-request"); | ||
const { getGqlClient } = require("./client"); | ||
const matter = require("gray-matter"); | ||
|
||
const produceMutation = (modelName = "Post") => gql` | ||
mutation uploadMds($data: ${modelName}CreateInput!) { | ||
create${modelName}(data: $data) { | ||
id | ||
} | ||
} | ||
`; | ||
|
||
const uploadMds = (mds, modelName) => { | ||
const client = getGqlClient(); | ||
return Promise.all( | ||
mds.map((md) => { | ||
const { content, data } = matter(md); | ||
// need to create AST from markdown | ||
return client.request(produceMutation(modelName), { | ||
data: { content: content, ...data }, | ||
}); | ||
}) | ||
); | ||
}; | ||
|
||
module.exports = uploadMds; |