MCPcopy Create free account
hub / github.com/baiwumm/react-admin / logout

Method logout

Xmw_server/src/modules/auth/auth.service.ts:163–177  ·  view source on GitHub ↗

* @description: 用户退出当前登录 * @author: 白雾茫茫丶

(session: SessionTypes)

Source from the content-addressed store, hash-verified

161 * @author: 白雾茫茫丶
162 */
163 async logout(session: SessionTypes): Promise<responseResult> {
164 const { currentUserInfo } = session;
165 if (currentUserInfo) {
166 const { user_id } = currentUserInfo;
167 // 清空数据库中 token
168 await this.userModel.update(
169 { token: '' },
170 {
171 where: { user_id },
172 },
173 );
174 return responseMessage({});
175 }
176 return responseMessage({}, '登录信息已失效!', 401);
177 }
178
179 /**
180 * @description: 获取用户按钮权限

Callers

nothing calls this directly

Calls 1

responseMessageFunction · 0.90

Tested by

no test coverage detected