PicList/src/main/utils/getPicBeds.ts
Molunerfinn 9d4d605acf Feature: only shows visible pic-beds
ISSUES CLOSED: #310
2019-12-28 16:23:16 +08:00

20 lines
533 B
TypeScript

import picgo from './picgo'
const getPicBeds = () => {
const picBedTypes = picgo.helper.uploader.getIdList()
const picBedFromDB = picgo.getConfig('picBed.list') || []
const picBeds = picBedTypes.map((item: string) => {
const visible = picBedFromDB.find((i: IPicBedType) => i.type === item) // object or undefined
return {
type: item,
name: picgo.helper.uploader.get(item).name || item,
visible: visible ? visible.visible : true
}
}) as IPicBedType[]
return picBeds
}
export {
getPicBeds
}