File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -135,12 +135,13 @@ export function showReportDialog(options: ReportDialogOptions = {}, hub: Hub = g
135
135
return ;
136
136
}
137
137
138
- if ( ! options . dsn ) {
139
- IS_DEBUG_BUILD && logger . error ( 'Missing dsn option in showReportDialog call' ) ;
138
+ const { client, scope } = hub . getStackTop ( ) ;
139
+ const dsn = options . dsn || ( client && client . getDsn ( ) ) ;
140
+ if ( ! dsn ) {
141
+ IS_DEBUG_BUILD && logger . error ( 'DSN not configured for showReportDialog call' ) ;
140
142
return ;
141
143
}
142
144
143
- const scope = hub . getScope ( ) ;
144
145
if ( scope ) {
145
146
options . user = {
146
147
...scope . getUser ( ) ,
@@ -154,7 +155,7 @@ export function showReportDialog(options: ReportDialogOptions = {}, hub: Hub = g
154
155
155
156
const script = global . document . createElement ( 'script' ) ;
156
157
script . async = true ;
157
- script . src = getReportDialogEndpoint ( options . dsn , options ) ;
158
+ script . src = getReportDialogEndpoint ( dsn , options ) ;
158
159
159
160
if ( options . onLoad ) {
160
161
// eslint-disable-next-line @typescript-eslint/unbound-method
Original file line number Diff line number Diff line change @@ -118,14 +118,15 @@ export function getReportDialogEndpoint(
118
118
}
119
119
120
120
if ( key === 'user' ) {
121
- if ( ! dialogOptions . user ) {
121
+ const user = dialogOptions . user ;
122
+ if ( ! user ) {
122
123
continue ;
123
124
}
124
- if ( dialogOptions . user . name ) {
125
- encodedOptions += `&name=${ encodeURIComponent ( dialogOptions . user . name ) } ` ;
125
+ if ( user . name ) {
126
+ encodedOptions += `&name=${ encodeURIComponent ( user . name ) } ` ;
126
127
}
127
- if ( dialogOptions . user . email ) {
128
- encodedOptions += `&email=${ encodeURIComponent ( dialogOptions . user . email ) } ` ;
128
+ if ( user . email ) {
129
+ encodedOptions += `&email=${ encodeURIComponent ( user . email ) } ` ;
129
130
}
130
131
} else {
131
132
encodedOptions += `&${ encodeURIComponent ( key ) } =${ encodeURIComponent ( dialogOptions [ key ] as string ) } ` ;
You can’t perform that action at this time.
0 commit comments