wikiquote-api
Version:
Small API for Wikiquote
19 lines (14 loc) • 304 B
JavaScript
import 'isomorphic-fetch'
export default async function jsonFromURL(url, param=null) {
if (param) {
url += encodeURIComponent(param)
}
const option = {
method: 'GET',
mode: 'cors',
credentials: 'omit',
}
const res = await fetch(url, option)
const json = await res.json()
return json
}