prevent JSON.parse fault when search is undefined
This commit is contained in:
parent
ffd668fb7d
commit
56a048865d
1 changed files with 5 additions and 1 deletions
|
@ -110,7 +110,11 @@
|
|||
|
||||
export function param2Obj(url) {
|
||||
const search = url.split('?')[1];
|
||||
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}')
|
||||
if (search !== undefined) {
|
||||
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');
|
||||
}
|
||||
return {};
|
||||
|
||||
}
|
||||
|
||||
export function html2Text(val) {
|
||||
|
|
Loading…
Reference in a new issue