-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
481 changed files
with
934,753 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
- OS: [e.g. iOS] | ||
- Browser [e.g. chrome, safari] | ||
- Version [e.g. 22] | ||
|
||
**Smartphone (please complete the following information):** | ||
- Device: [e.g. iPhone6] | ||
- OS: [e.g. iOS8.1] | ||
- Browser [e.g. stock browser, safari] | ||
- Version [e.g. 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
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,54 @@ | ||
const NetlifyGraph = require('./netlifyGraph'); | ||
|
||
exports.handler = async (event) => { | ||
// By default, all API calls use no authentication | ||
let accessToken; | ||
|
||
//// If you want to use the client's accessToken when making API calls on the user's behalf: | ||
// accessToken = event.headers["authorization"]?.split(" ")[1] | ||
|
||
//// If you want to use the API with your own access token: | ||
// accessToken = event.authlifyToken | ||
|
||
const eventBodyJson = JSON.parse(event.body || '{}'); | ||
|
||
const { errors: ExampleQueryErrors, data: ExampleQueryData } = await NetlifyGraph.fetchExampleQuery({}, { accessToken: accessToken }); | ||
|
||
if (ExampleQueryErrors) { | ||
console.error(JSON.stringify(ExampleQueryErrors, null, 2)); | ||
} | ||
|
||
console.log(JSON.stringify(ExampleQueryData, null, 2)); | ||
|
||
return { | ||
statusCode: 200, | ||
body: JSON.stringify({ | ||
success: true, | ||
ExampleQueryErrors: ExampleQueryErrors, | ||
ExampleQueryData: ExampleQueryData | ||
}), | ||
headers: { | ||
'content-type': 'application/json' | ||
} | ||
}; | ||
}; | ||
|
||
/** | ||
* Client-side invocations: | ||
* Call your Netlify function from the browser (after saving | ||
* the code to `ExampleQuery.js`) with these helpers: | ||
*/ | ||
|
||
|
||
async function fetchExampleQuery(params) { | ||
const {} = params || {}; | ||
const resp = await fetch(`/.netlify/functions/ExampleQuery?`, | ||
{ | ||
method: "GET" | ||
}); | ||
|
||
const text = await resp.text(); | ||
|
||
return JSON.parse(text); | ||
} | ||
|
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,30 @@ | ||
const contextCondition = "production"; | ||
const stateCondition = "ready"; | ||
const sitemapUrl = process.env.SITEMAP_URL; | ||
const axios = require("axios"); | ||
exports.handler = async (event) => { | ||
try { | ||
const { payload } = JSON.parse(event.body); | ||
const { state, context } = payload; | ||
if ( | ||
sitemapUrl && | ||
state === stateCondition && | ||
context === contextCondition | ||
) { | ||
console.log(`Sending sitemap ping to google for ${sitemapUrl}`); | ||
await axios.get(`http://www.google.com/ping?sitemap=${sitemapUrl}`); | ||
return { | ||
statusCode: 200, | ||
body: `Submitted Successfully`, | ||
}; | ||
} | ||
console.log("Conditions not met, not submitting"); | ||
return { | ||
statusCode: 200, | ||
body: `Conditions not met, not submitting`, | ||
}; | ||
} catch (err) { | ||
console.log(err); | ||
throw err; | ||
} | ||
}; |
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,33 @@ | ||
import { | ||
fetchExampleQuery | ||
} from '../netlifyGraph' // make sure this is the path to your netlify/functions dir | ||
|
||
exports.handler = async function(event, context) { | ||
const { | ||
errors, | ||
data | ||
} = await fetchExampleQuery({ | ||
/* variables */ | ||
}, { | ||
accessToken: event.netlifyGraphToken | ||
}) | ||
|
||
return { | ||
statusCode: errors ? 500 : 200, | ||
body: JSON.stringify(errors || data), | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
} | ||
} | ||
accessToken: event.netlifyGraphToken | ||
}) | ||
|
||
return { | ||
statusCode: errors ? 500 : 200, | ||
body: JSON.stringify(errors || data), | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
} | ||
} |
Oops, something went wrong.