Fix linting

This commit is contained in:
Gusted 2021-05-28 21:17:22 +02:00
parent 2f6811e15b
commit 6d5df7b079
No known key found for this signature in database
GPG Key ID: FD821B732837125F
3 changed files with 14 additions and 13 deletions

View File

@ -48,7 +48,7 @@ const styleMan = (() => {
name: style => `ID: ${style.id}`,
_id: () => uuidv4(),
_rev: () => Date.now(),
_uswToken: () => "",
_uswToken: () => '',
};
const DELETE_IF_NULL = ['id', 'customName', 'md5Url', 'originalMd5'];
/** @type {Promise|boolean} will be `true` to avoid wasting a microtask tick on each `await` */
@ -358,9 +358,9 @@ const styleMan = (() => {
if (!style.id) {
return;
}
const result_token = await tokenMan.getToken('userstylesworld', true, style.id);
style._uswToken = result_token;
await saveStyle(style)
const resultToken = await tokenMan.getToken('userstylesworld', true, style.id);
style._uswToken = resultToken;
await saveStyle(style);
broadcastStyleUpdated(style, 'updateLinking');
});
}

View File

@ -65,9 +65,9 @@ const tokenMan = (() => {
buildKeys(name, styleId) {
const k = {
TOKEN: `secure/token/${name}/${styleId ? `${styleId}/`: ''}token`,
EXPIRE: `secure/token/${name}/${styleId ? `${styleId}/`: ''}expire`,
REFRESH: `secure/token/${name}/${styleId ? `${styleId}/`: ''}refresh`,
TOKEN: `secure/token/${name}/${styleId ? `${styleId}/` : ''}token`,
EXPIRE: `secure/token/${name}/${styleId ? `${styleId}/` : ''}expire`,
REFRESH: `secure/token/${name}/${styleId ? `${styleId}/` : ''}refresh`,
};
k.LIST = Object.values(k);
return k;

View File

@ -54,13 +54,14 @@ msg.onExtension(request => {
const {style} = request;
switch (request.method) {
case 'styleUpdated':
if (editor.style.id === style.id)
if (editor.style.id === style.id) {
if (!['editPreview', 'editPreviewEnd', 'editSave', 'config'].includes(request.reason)) {
Promise.resolve(request.codeIsUpdated === false ? style : API.styles.get(style.id))
.then(newStyle => editor.replaceStyle(newStyle, request.codeIsUpdated));
}
if (request.reason === 'updateLinking') {
console.log(editor.style._uswToken)
Promise.resolve(request.codeIsUpdated === false ? style : API.styles.get(style.id))
.then(newStyle => editor.replaceStyle(newStyle, request.codeIsUpdated));
}
if (request.reason === 'updateLinking') {
console.log(editor.style._uswToken);
}
}
break;
case 'styleDeleted':