feat: add project-scoped work assistant results
This commit is contained in:
@@ -12,6 +12,13 @@ import {
|
||||
type UserPosition
|
||||
} from './auth';
|
||||
|
||||
export const fetchMobileIdentity = () => apiRequest<MobileIdentity>({
|
||||
url: '/api/aihr/mobile/me',
|
||||
method: 'GET',
|
||||
timeout: 15000,
|
||||
clearAuthOnUnauthorized: false
|
||||
});
|
||||
|
||||
export const userTabPages = new Set([
|
||||
'/pages/user/today/index',
|
||||
'/pages/user/practice/index',
|
||||
@@ -35,12 +42,7 @@ export const routeForMobileRole = (role: RoleKey, requested: string) => {
|
||||
|
||||
export const hydrateMobileRole = async (): Promise<RoleKey> => {
|
||||
try {
|
||||
const identity = await apiRequest<MobileIdentity>({
|
||||
url: '/api/aihr/mobile/me',
|
||||
method: 'GET',
|
||||
timeout: 15000,
|
||||
clearAuthOnUnauthorized: false
|
||||
});
|
||||
const identity = await fetchMobileIdentity();
|
||||
const role = identity.role === 'supervisor' ? 'supervisor' : 'user';
|
||||
uni.setStorageSync(roleKey, role);
|
||||
if (role !== 'supervisor') leaveSupervisorLearnerMode();
|
||||
@@ -71,12 +73,7 @@ export type OrgPositionResult =
|
||||
|
||||
export const fetchOrgPositionResult = async (): Promise<OrgPositionResult> => {
|
||||
try {
|
||||
const identity = await apiRequest<MobileIdentity>({
|
||||
url: '/api/aihr/mobile/me',
|
||||
method: 'GET',
|
||||
timeout: 15000,
|
||||
clearAuthOnUnauthorized: false
|
||||
});
|
||||
const identity = await fetchMobileIdentity();
|
||||
const officialPosition = saveOrgPosition(identity.positionName);
|
||||
if (!officialPosition) {
|
||||
clearOrgPosition();
|
||||
|
||||
Reference in New Issue
Block a user