MCPcopy
hub / github.com/1Panel-dev/KubePi / getCurrentUser

Function getCurrentUser

web/dashboard/src/store/modules/user.js:92–110  ·  view source on GitHub ↗
({commit})

Source from the content-addressed store, hash-verified

90 })
91 },
92 getCurrentUser({commit}) {
93 return new Promise((resolve, reject) => {
94 const clusterName = store.getters.cluster
95 getCurrentClusterUser(clusterName).then(data => {
96 const user = data.data
97 user["roles"] = ["ADMIN"]
98 const {name, nickName, roles, language, isAdministrator, clusterRoles} = user
99 commit("SET_NAME", name)
100 commit("SET_ROLES", roles)
101 commit("SET_CLUSTER_ROLES", clusterRoles)
102 commit("SET_NICK_NAME", nickName)
103 commit("SET_LANGUAGE", language)
104 commit("SET_ADMINISTRATOR", isAdministrator)
105 resolve(user)
106 }).catch(error => {
107 reject(error)
108 })
109 })
110 },
111 logout({commit}) {
112 logout().then(() => {
113 commit("LOGOUT")

Callers

nothing calls this directly

Calls 2

getCurrentClusterUserFunction · 0.90
resolveFunction · 0.50

Tested by

no test coverage detected