-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use shared dev dependency configs
- Loading branch information
Showing
85 changed files
with
5,568 additions
and
5,202 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
import config from "@eik/eslint-config"; | ||
|
||
export default config; |
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 |
---|---|---|
@@ -1,22 +1,19 @@ | ||
/* eslint-disable no-console */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
|
||
import FormData from 'form-data'; | ||
import fetch from 'node-fetch'; | ||
import FormData from "form-data"; | ||
import fetch from "node-fetch"; | ||
|
||
const authenticate = async (address) => { | ||
const formData = new FormData(); | ||
formData.append('key', 'change_me'); | ||
const formData = new FormData(); | ||
formData.append("key", "change_me"); | ||
|
||
const res = await fetch(`${address}/auth/login`, { | ||
method: 'POST', | ||
body: formData, | ||
headers: formData.getHeaders(), | ||
}); | ||
const res = await fetch(`${address}/auth/login`, { | ||
method: "POST", | ||
body: formData, | ||
headers: formData.getHeaders(), | ||
}); | ||
|
||
const body = await res.json(); | ||
const body = await res.json(); | ||
|
||
console.log(body); | ||
} | ||
console.log(body); | ||
}; | ||
|
||
authenticate('http://localhost:4001'); | ||
authenticate("http://localhost:4001"); |
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 |
---|---|---|
@@ -1,52 +1,49 @@ | ||
/* eslint-disable no-console */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
|
||
import FormData from 'form-data'; | ||
import fetch from 'node-fetch'; | ||
import FormData from "form-data"; | ||
import fetch from "node-fetch"; | ||
|
||
const authenticate = async (address) => { | ||
const formData = new FormData(); | ||
formData.append('key', 'change_me'); | ||
const formData = new FormData(); | ||
formData.append("key", "change_me"); | ||
|
||
const res = await fetch(`${address}/auth/login`, { | ||
method: 'POST', | ||
body: formData, | ||
headers: formData.getHeaders(), | ||
}); | ||
const res = await fetch(`${address}/auth/login`, { | ||
method: "POST", | ||
body: formData, | ||
headers: formData.getHeaders(), | ||
}); | ||
|
||
return res.json(); | ||
} | ||
return res.json(); | ||
}; | ||
|
||
const del = async (address) => { | ||
const auth = await authenticate(address); | ||
|
||
const headers = { | ||
'Authorization': `Bearer ${auth.token}` | ||
}; | ||
|
||
const res = await fetch(`${address}/map/buzz/v4`, { | ||
method: 'DELETE', | ||
headers, | ||
}) | ||
|
||
let result = {}; | ||
switch (res.status) { | ||
case 204: | ||
result = { status: res.status, message: 'Deleted' }; | ||
break; | ||
case 401: | ||
result = { status: res.status, message: 'Unauthorized' }; | ||
break; | ||
case 404: | ||
result = { status: res.status, message: 'Not found' }; | ||
break; | ||
case 502: | ||
result = { status: res.status, message: 'Writing file failed' }; | ||
break; | ||
default: | ||
result = { status: res.status }; | ||
} | ||
console.log(result); | ||
} | ||
|
||
del('http://localhost:4001'); | ||
const auth = await authenticate(address); | ||
|
||
const headers = { | ||
Authorization: `Bearer ${auth.token}`, | ||
}; | ||
|
||
const res = await fetch(`${address}/map/buzz/v4`, { | ||
method: "DELETE", | ||
headers, | ||
}); | ||
|
||
let result = {}; | ||
switch (res.status) { | ||
case 204: | ||
result = { status: res.status, message: "Deleted" }; | ||
break; | ||
case 401: | ||
result = { status: res.status, message: "Unauthorized" }; | ||
break; | ||
case 404: | ||
result = { status: res.status, message: "Not found" }; | ||
break; | ||
case 502: | ||
result = { status: res.status, message: "Writing file failed" }; | ||
break; | ||
default: | ||
result = { status: res.status }; | ||
} | ||
console.log(result); | ||
}; | ||
|
||
del("http://localhost:4001"); |
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 |
---|---|---|
@@ -1,10 +1,7 @@ | ||
/* eslint-disable no-console */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import fetch from "node-fetch"; | ||
|
||
import fetch from 'node-fetch'; | ||
|
||
fetch('http://localhost:4001/map/buzz/v4', { | ||
method: 'GET', | ||
fetch("http://localhost:4001/map/buzz/v4", { | ||
method: "GET", | ||
}) | ||
.then(res => res.json()) | ||
.then(json => console.log(json)); | ||
.then((res) => res.json()) | ||
.then((json) => console.log(json)); |
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 |
---|---|---|
@@ -1,54 +1,54 @@ | ||
/* eslint-disable no-console */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
|
||
import FormData from 'form-data'; | ||
import fetch from 'node-fetch'; | ||
import FormData from "form-data"; | ||
import fetch from "node-fetch"; | ||
|
||
const authenticate = async (address) => { | ||
const formData = new FormData(); | ||
formData.append('key', 'change_me'); | ||
const formData = new FormData(); | ||
formData.append("key", "change_me"); | ||
|
||
const res = await fetch(`${address}/auth/login`, { | ||
method: 'POST', | ||
body: formData, | ||
headers: formData.getHeaders(), | ||
}); | ||
const res = await fetch(`${address}/auth/login`, { | ||
method: "POST", | ||
body: formData, | ||
headers: formData.getHeaders(), | ||
}); | ||
|
||
return res.json(); | ||
} | ||
return res.json(); | ||
}; | ||
|
||
const post = async (address) => { | ||
const auth = await authenticate(address); | ||
|
||
const formData = new FormData(); | ||
formData.append('version', '4.4.2'); | ||
|
||
const headers = {'Authorization': `Bearer ${auth.token}`, ...formData.getHeaders()}; | ||
|
||
const res = await fetch(`${address}/map/buzz/v4`, { | ||
method: 'POST', | ||
body: formData, | ||
headers, | ||
}) | ||
|
||
let result = {}; | ||
switch (res.status) { | ||
case 200: | ||
result = await res.json(); | ||
break; | ||
case 401: | ||
result = { status: res.status, message: 'Unauthorized' }; | ||
break; | ||
case 404: | ||
result = { status: res.status, message: 'Not found' }; | ||
break; | ||
case 502: | ||
result = { status: res.status, message: 'Writing file failed' }; | ||
break; | ||
default: | ||
result = { status: res.status }; | ||
} | ||
console.log(result); | ||
} | ||
|
||
post('http://localhost:4001'); | ||
const auth = await authenticate(address); | ||
|
||
const formData = new FormData(); | ||
formData.append("version", "4.4.2"); | ||
|
||
const headers = { | ||
Authorization: `Bearer ${auth.token}`, | ||
...formData.getHeaders(), | ||
}; | ||
|
||
const res = await fetch(`${address}/map/buzz/v4`, { | ||
method: "POST", | ||
body: formData, | ||
headers, | ||
}); | ||
|
||
let result = {}; | ||
switch (res.status) { | ||
case 200: | ||
result = await res.json(); | ||
break; | ||
case 401: | ||
result = { status: res.status, message: "Unauthorized" }; | ||
break; | ||
case 404: | ||
result = { status: res.status, message: "Not found" }; | ||
break; | ||
case 502: | ||
result = { status: res.status, message: "Writing file failed" }; | ||
break; | ||
default: | ||
result = { status: res.status }; | ||
} | ||
console.log(result); | ||
}; | ||
|
||
post("http://localhost:4001"); |
Oops, something went wrong.