use URLSearchParams
This commit is contained in:
parent
ede20ca30c
commit
5d359827da
|
@ -18,12 +18,8 @@
|
||||||
sendPostMessage({type: 'usw-remove-stylus-button'});
|
sendPostMessage({type: 'usw-remove-stylus-button'});
|
||||||
|
|
||||||
if (location.pathname === '/api/oauth/style/new') {
|
if (location.pathname === '/api/oauth/style/new') {
|
||||||
// Gets the search query string, and get the vendor_data from it.
|
const styleId = Number(new URLSearchParams(location.search).get('vendor_data'));
|
||||||
// Which is the id of the style that shall be linked with.
|
API.styles.get(styleId).then(style => {
|
||||||
const vendorData = window.location.search.split('&')
|
|
||||||
.find(query => query.startsWith('vendor_data'))
|
|
||||||
.split('=')[1];
|
|
||||||
API.styles.get(Number(vendorData)).then(style => {
|
|
||||||
style.sourceCode = style.tmpSourceCode;
|
style.sourceCode = style.tmpSourceCode;
|
||||||
sendPostMessage({type: 'usw-fill-new-style', data: style});
|
sendPostMessage({type: 'usw-fill-new-style', data: style});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user