Browse Source

docs(@vben/docs): fix setUserInfo store reference in access guide (#8313)

The access control guide referenced authStore.setUserInfo, but the user
store (useUserStore) is what exposes setUserInfo in the current code.
Align the documented API with the implementation in
packages/stores/src/modules/user.ts.

Co-authored-by: EvoX <evox@evomap.ai>
pull/8317/head
俞可 · YU KE 1 month ago
committed by GitHub
parent
commit
723ee5980f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      docs/src/en/guide/in-depth/access.md
  2. 4
      docs/src/guide/in-depth/access.md

4
docs/src/en/guide/in-depth/access.md

@ -53,7 +53,7 @@ You can look under `src/store/auth` in the application to find the following cod
```ts
// Set the login user information, ensuring that userInfo.roles is an array and contains permissions from the route table
// For example: userInfo.roles=['super', 'admin']
authStore.setUserInfo(userInfo);
userStore.setUserInfo(userInfo);
```
At this point, the configuration is complete. You need to ensure that the roles returned by the interface after login match the permissions in the route table; otherwise, access will not be possible.
@ -204,7 +204,7 @@ const [fetchUserInfoResult, accessCodes] = await Promise.all([
]);
userInfo = fetchUserInfoResult;
authStore.setUserInfo(userInfo);
userStore.setUserInfo(userInfo);
accessStore.setAccessCodes(accessCodes);
```

4
docs/src/guide/in-depth/access.md

@ -53,7 +53,7 @@ export const overridesPreferences = defineOverridesPreferences({
```ts
// 设置登录用户信息,需要确保 userInfo.roles 是一个数组,且包含路由表中的权限
// 例如:userInfo.roles=['super', 'admin']
authStore.setUserInfo(userInfo);
userStore.setUserInfo(userInfo);
```
到这里,就已经配置完成,你需要确保登录后,接口返回的角色和路由表的权限匹配,否则无法访问。
@ -212,7 +212,7 @@ const [fetchUserInfoResult, accessCodes] = await Promise.all([
]);
userInfo = fetchUserInfoResult;
authStore.setUserInfo(userInfo);
userStore.setUserInfo(userInfo);
accessStore.setAccessCodes(accessCodes);
```

Loading…
Cancel
Save