Skip to content

Commit

Permalink
perf(sso): store define move up
Browse files Browse the repository at this point in the history
  • Loading branch information
jiawei397 committed Aug 30, 2022
1 parent bc186ee commit fb65922
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions modules/uinv/src/guards/sso.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export function SSOGuard(options: SSOGuardOptions = {}) {
const userAgent = headers.get("user-agent") || ssoUserAgent ||
Deno.env.get("ssoUserAgent") || "";
const realReferer = headers.get("referer") || referer || "";
const store = typeof cacheStore === "function"
? await cacheStore()
: cacheStore;
if (headers.get("app") === "1") {
const userInfos = await ajax.post<SSOUserInfo[]>(ssoUserInfosUrl, {
user_ids: [1],
Expand All @@ -75,9 +78,7 @@ export function SSOGuard(options: SSOGuardOptions = {}) {
},
cacheTimeout,
originHeaders: headers,
cacheStore: typeof cacheStore === "function"
? await cacheStore()
: cacheStore,
cacheStore: store,
});
if (userInfos && userInfos.length > 0) {
userInfo = userInfos[0];
Expand All @@ -92,9 +93,7 @@ export function SSOGuard(options: SSOGuardOptions = {}) {
},
cacheTimeout,
originHeaders: headers,
cacheStore: typeof cacheStore === "function"
? await cacheStore()
: cacheStore,
cacheStore: store,
});
}
if (userInfo) {
Expand Down

0 comments on commit fb65922

Please sign in to comment.