我真的不确定如何解释这一点。
我的网站(something
)上有一个个人资料页面,可访问API(something
)
/profile
返回以下JSON-/api/testAPI/currentuser.php
在我的react组件中,我使用以下功能在currentuser.php
阶段获取此端点
{loggedin: true, uid: "3", username: "TechPhil", permissions: "none"}
不要问我为什么,但是我可以使用componentDidMount()
来访问fetch("/api/testAPI/currentuser.php")
.then((res) => res.json())
.then((res) => {
this.setState({
apiResponse: res
})
})
,uid
和username
键,但是我出于某些原因根本无法访问permissions
?
我将完整的组件代码放在下面。
this.state.apiResponse.key