fix(mobile): fail closed on org role lookup errors
This commit is contained in:
@@ -39,7 +39,9 @@ export const hydrateMobileRole = async (): Promise<RoleKey> => {
|
||||
uni.setStorageSync(roleKey, role);
|
||||
return role;
|
||||
} catch {
|
||||
return (uni.getStorageSync(roleKey) === 'supervisor' ? 'supervisor' : 'user') as RoleKey;
|
||||
// ponytail: role lookup failure fails closed; never reuse a stale supervisor cache.
|
||||
uni.removeStorageSync(roleKey);
|
||||
return 'user';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ test('登录后按组织身份切换主管首页', async () => {
|
||||
assert.match(source, /\/api\/aihr\/mobile\/me/);
|
||||
assert.match(source, /role === 'supervisor'/);
|
||||
assert.match(source, /pages\/supervisor\/index\/index/);
|
||||
assert.match(source, /removeStorageSync\(roleKey\)/);
|
||||
});
|
||||
|
||||
test('员工首页保留师傅区、语音条、今日安排、我的地图四段结构', async () => {
|
||||
|
||||
Reference in New Issue
Block a user