Skip to content

Commit

Permalink
fix: get org info before registerModule (erda-project#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
sherotree authored and licao404 committed May 19, 2021
1 parent 65df518 commit 1883dbe
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions shell/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,34 @@ const start = (userData: ILoginUser) => {

const IconConfig = {
...DEFAULT_ICON_CONFIGS,
prefix: 'erda'
prefix: 'erda',
};

startApp().then(async (App) => {
[
import('layout/entry'),
import('org/entry'),
import('app/org-home/entry'),
import('workBench/entry'),
import('runtime/entry'),
import('publisher/entry'),
import('project/entry'),
import('apiManagePlatform/entry'),
import('microService/entry'),
import('app/modules/edge/entry'),
import('application/entry'),
import('dataCenter/entry'),
import('user/entry'),
import('dcos/entry'),
import('addonPlatform/entry'),
...Object.values(modules),
].forEach((p) => p.then(m => m.default(registerModule)));
userStore.reducers.setLoginUser(userData); // 需要在app start之前初始化用户信息
// get the organization info first, or will get org is undefined when need org info (like issueStore)
if (!userData.isSysAdmin) {
const orgName = get(location.pathname.split('/'), '[1]');
await orgStore.effects.getOrgByDomain({ orgName });
}
[
import('layout/entry'),
import('org/entry'),
import('app/org-home/entry'),
import('workBench/entry'),
import('runtime/entry'),
import('publisher/entry'),
import('project/entry'),
import('apiManagePlatform/entry'),
import('microService/entry'),
import('app/modules/edge/entry'),
import('application/entry'),
import('dataCenter/entry'),
import('user/entry'),
import('dcos/entry'),
import('addonPlatform/entry'),
...Object.values(modules),
].forEach((p) => p.then(m => m.default(registerModule)));
userStore.reducers.setLoginUser(userData); // 需要在app start之前初始化用户信息
const Wrap = () => {
const currentLocale = getCurrentLocale();
return (
Expand Down Expand Up @@ -147,7 +148,7 @@ const init = (userData: ILoginUser) => {
window.location.href = lastPath;
return;
}
start({ ...userData })
start({ ...userData });
} else {
// 验证系统管理员相关路由
setSysAdminLocationByAuth({
Expand Down

0 comments on commit 1883dbe

Please sign in to comment.