-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.js
More file actions
28 lines (28 loc) · 680 Bytes
/
lib.js
File metadata and controls
28 lines (28 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// crazy that i need to inject a fetch method
// writing extensions is really fun for sure !
export const postToServer = ({
controller,
difficulty,
formattedTitle,
suffix,
url,
code,
password,
fetchMethod,
posturl = 'http://www.jasontung.me:3001/updateGithub',
}) =>
fetchMethod(posturl, {
signal: controller.signal,
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
difficulty,
formattedTitle,
suffix,
fileText: `# ${url}\n${code}`,
url,
apiKey: password,
}),
});