fix(err-monitor): stop monitoring if monitorurl not exist (#423)

* fix(err-monitor): stop monitoring if monitorurl not exist

* fix(error-monitor): cancel request if url not exist
This commit is contained in:
chilingling 2024-04-15 20:21:06 -07:00 committed by GitHub
parent f7980d8c83
commit da8f58b0d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -24,7 +24,13 @@ const http = useHttp()
* @param { json } params {"event_type": design_error,"url": "elit in reprehenderit enim incididunt" }
* @returns { Promise }
*/
export const requestEvent = (url, params) => http.post(url, params).catch(() => {})
export const requestEvent = (url, params) => {
if (!url) {
return
}
return http.post(url, params).catch(() => {})
}
/**
* 页面更新

View File

@ -93,6 +93,10 @@ const promiseMonitoring = () => {
*/
export const iframeMonitoring = () => {
if (!monitorUrl) {
return false
}
window.frames[0].onerror = function (errorMessage, scriptURI, lineNo, columnNo, error) {
requestEvent(monitorUrl, {
event_type: 'design_iframeError',