Last active
October 19, 2021 18:00
-
-
Save wattanakorn495/c21dded555fbef89182ead8abcff3caa to your computer and use it in GitHub Desktop.
ดึง list ของรูปภาพจากเลข cprcode
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
import axios from "axios"; | |
import { IMAGES_ENDPOINT } from "../config/images"; | |
let Images = {}; | |
export async function loadAllImages() { | |
const data = (await axios.get(IMAGES_ENDPOINT)).data; | |
Images = data; | |
} | |
export function getImages(cprcode) { | |
const padded = cprcode.toString().padStart(7, "0"); | |
return Images[padded] || []; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment