24 lines
590 B
JavaScript
24 lines
590 B
JavaScript
import request from "./request";
|
|
import {
|
|
setStorageWithExpiry,
|
|
getStorageWithExpiry
|
|
} from './auth'
|
|
|
|
export function getDictDataByType(type) {
|
|
let data = getStorageWithExpiry(type)
|
|
if (data === null || data === undefined) {
|
|
request({
|
|
url: '/system/dict-data/type',
|
|
method: 'get',
|
|
params: {type: type}
|
|
}).then(res => {
|
|
setStorageWithExpiry(type, res.data, 3600)
|
|
return res.data
|
|
}).catch(() => {
|
|
console.log("出现了异常")
|
|
})
|
|
} else {
|
|
return data
|
|
}
|
|
}
|