21 lines
No EOL
544 B
TypeScript
21 lines
No EOL
544 B
TypeScript
import axios from "axios"
|
|
import { Character, CharacterList } from "./types"
|
|
|
|
function getOC(oc: Character) {
|
|
return axios.get(`${process.env.BOORU_URL}/api/posts?query=${encodeURIComponent(`refsheet safety:safe ${oc.booru_tag}`)}`).then(res => {
|
|
return {
|
|
...oc,
|
|
image: `${process.env.BOORU_URL}/${res.data.results[0].contentUrl}`
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
export default async function getRefs(ocs: CharacterList) {
|
|
let ps = ocs.map(oc => {
|
|
return getOC(oc)
|
|
})
|
|
|
|
return Promise.all([...ps])
|
|
|
|
} |