通过url中携带的参数来判断

This commit is contained in:
2026-02-27 10:39:45 +08:00
parent 6571d91c7a
commit b84f41cc31

View File

@@ -76,11 +76,19 @@ const IframePostMessage = () => {
* fetchAndStoreEmail * fetchAndStoreEmail
* 调用 /console/api/account/profile 接口,获取当前用户信息, * 调用 /console/api/account/profile 接口,获取当前用户信息,
* 并将其中的 email 字段写入浏览器 Cookie。 * 并将其中的 email 字段写入浏览器 Cookie。
* 若当前页面 URL 携带 key 参数,则跳过请求与写入。
*/ */
const fetchAndStoreEmail = async () => { const fetchAndStoreEmail = async () => {
try { try {
if (typeof window !== 'undefined' && window.parent !== window) if (typeof window !== 'undefined') {
return try {
const hasKeyParam = new URL(globalThis.location.href).searchParams.has('key')
if (hasKeyParam) return
}
catch {
// ignore parse error
}
}
const profile = await get<{ email: string }>('/account/profile') const profile = await get<{ email: string }>('/account/profile')
const email = profile?.email || '' const email = profile?.email || ''
if (email) { if (email) {