export default (btnName: string): any | undefined => {
    const storedPermissions = sessionStorage.getItem('permissions');
    if (!storedPermissions) {
        return false; // 或抛出错误，视具体需求而定
    }
    try {
        const storedObject = JSON.parse(storedPermissions);
        // 使用 in 关键字或 hasOwnProperty 方法判断属性是否存在
        if (btnName in storedObject || storedObject.hasOwnProperty(btnName)) {
            return storedObject[btnName];
        } else {
            return false;
        }
    } catch (error) {
        console.error('Error parsing stored object:', error);
        return false; // 或抛出错误，视具体需求而定
    }
}