mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2026-10-06 14:23:19 +08:00
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>
This commit is contained in:
@@ -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);
|
||||
```
|
||||
|
||||
|
||||
@@ -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);
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user