调整代码
This commit is contained in:
parent
593f7977eb
commit
e8da2ee3f8
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import config from './config'
|
import config from './config'
|
||||||
// const VITE_CREATE_POST_MESSAGE_URL = import.meta.env.VITE_CREATE_POST_MESSAGE_URL;
|
// const VITE_CREATE_POST_MESSAGE_URL = import.meta.env.VITE_CREATE_POST_MESSAGE_URL;
|
||||||
const VITE_AI_POST_MESSAGE_URL = location.origin;
|
const VITE_CREATE_POST_MESSAGE_URL = location.origin;
|
||||||
const SOURCE = 'leai-creation'
|
const SOURCE = 'leai-creation'
|
||||||
const VERSION = 1
|
const VERSION = 1
|
||||||
const TIMEOUT = 30000
|
const TIMEOUT = 30000
|
||||||
@ -18,7 +18,7 @@ const targetOrigin = config.parentOrigins.length > 0 ? config.parentOrigins[0] :
|
|||||||
|
|
||||||
export function send(type, payload = {}) {
|
export function send(type, payload = {}) {
|
||||||
if (!isEmbedded) return
|
if (!isEmbedded) return
|
||||||
window.parent.postMessage({ source: SOURCE, version: VERSION, type, payload }, VITE_AI_POST_MESSAGE_URL)
|
window.parent.postMessage({ source: SOURCE, version: VERSION, type, payload }, VITE_CREATE_POST_MESSAGE_URL)
|
||||||
}
|
}
|
||||||
export function request(type, payload = {}) {
|
export function request(type, payload = {}) {
|
||||||
if (!isEmbedded) return Promise.reject(new Error('Not in iframe'))
|
if (!isEmbedded) return Promise.reject(new Error('Not in iframe'))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user