fix some
This commit is contained in:
parent
d8f261382d
commit
fd25da4ae1
10
main.go
10
main.go
|
@ -94,13 +94,17 @@ func logout(ctx *gin.Context) {
|
|||
func userConfig(ctx *gin.Context) {
|
||||
|
||||
session := sessions.Default(ctx)
|
||||
user := session.Get(SessionUser)
|
||||
userSession := session.Get(SessionUser)
|
||||
// log.Println(user)
|
||||
if user == nil {
|
||||
if userSession == nil {
|
||||
ctx.JSON(http.StatusUnauthorized, gin.H{"error": "权限错误"})
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, gin.H{"message": "获取配置成功", "user": user.(*User).Name})
|
||||
|
||||
user := userSession.(*User)
|
||||
user.Config = map[string]string{"a": "b", "ocean-app-id": "dasdsa"}
|
||||
|
||||
ctx.JSON(http.StatusOK, gin.H{"message": "获取配置成功", "user": user.Name, "config": user.Config})
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -33,8 +33,6 @@ class Login extends React.Component {
|
|||
form.append("user", user);
|
||||
form.append("pwd", pwd);
|
||||
axios.post("/api/login", form).then(value => {
|
||||
console.log(value);
|
||||
console.log("Cookies are ", document.cookie)
|
||||
ReactDom.render(<SiderConfig userName={user}></SiderConfig>, document.getElementById('root'))
|
||||
return
|
||||
});
|
||||
|
|
|
@ -20,9 +20,11 @@ class NamespaceSelect extends React.Component {
|
|||
|
||||
onDropdownVisibleChange = (open) => {
|
||||
if(open) {
|
||||
var resp = axios.post("/api/user/config")
|
||||
axios.post("/api/user/config").then( resp => {
|
||||
console.log(resp.data);
|
||||
} );
|
||||
|
||||
|
||||
console.log(resp)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user