2019-12-26 07:15:41 -05:00
|
|
|
import picgo from './picgo'
|
2018-12-23 10:15:00 -05:00
|
|
|
|
2019-12-26 07:15:41 -05:00
|
|
|
const getPicBeds = () => {
|
2018-12-23 10:15:00 -05:00
|
|
|
const picBedTypes = picgo.helper.uploader.getIdList()
|
2019-12-28 03:23:16 -05:00
|
|
|
const picBedFromDB = picgo.getConfig('picBed.list') || []
|
2019-12-19 06:17:21 -05:00
|
|
|
const picBeds = picBedTypes.map((item: string) => {
|
2019-12-21 04:28:29 -05:00
|
|
|
const visible = picBedFromDB.find((i: IPicBedType) => i.type === item) // object or undefined
|
2018-12-23 10:15:00 -05:00
|
|
|
return {
|
|
|
|
type: item,
|
|
|
|
name: picgo.helper.uploader.get(item).name || item,
|
|
|
|
visible: visible ? visible.visible : true
|
|
|
|
}
|
2019-12-21 04:28:29 -05:00
|
|
|
}) as IPicBedType[]
|
2018-12-23 10:15:00 -05:00
|
|
|
return picBeds
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
getPicBeds
|
|
|
|
}
|