Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var AllIcons = "https://i.olsh.me/allicons.json";
- var resize = "https://images.weserv.nl/?w=96&h=96&page=-1&url=";
- import axios from 'axios';
- export default LoadIcon;
- function LoadIcon(url,callback)
- {
- const axios = require("axios");
- axios({
- "method":"GET",
- "url":AllIcons,
- "params":{
- "url":url
- }
- })
- .then((response)=>{
- if(response.data.icons.length > 0)
- {
- var iconUrl = resize + response.data.icons[0].url;
- callback(iconUrl);
- }
- else
- {
- console.log("No icons found for " + url);
- }
- })
- .catch((error)=>{
- console.log("icon api error: " + error + " icon = " + url);
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement