🚨 Lint

This commit is contained in:
Liyas Thomas
2020-02-19 09:29:49 +05:30
parent 0b6671d538
commit 4665dbc372
4 changed files with 54 additions and 42 deletions

View File

@@ -121,4 +121,4 @@ export const commonHeaders = [
"X-Requested-With", "X-Requested-With",
"X-Robots-Tag", "X-Robots-Tag",
"X-UA-Compatible" "X-UA-Compatible"
] ];

View File

@@ -5,16 +5,19 @@ const EXTENSION_ID = "amknoiejhlmhancpahfcfcfhllgkpbld";
// Also check for the presence of window.chrome object to confirm smooth operations // Also check for the presence of window.chrome object to confirm smooth operations
export const hasChromeExtensionInstalled = () => { export const hasChromeExtensionInstalled = () => {
return document.getElementById("chromePWExtensionDetect") !== null; return document.getElementById("chromePWExtensionDetect") !== null;
} };
const chromeWithoutProxy = (req, _store) => new Promise((resolve, reject) => { const chromeWithoutProxy = (req, _store) =>
new Promise((resolve, reject) => {
chrome.runtime.sendMessage( chrome.runtime.sendMessage(
EXTENSION_ID, { EXTENSION_ID,
{
messageType: "send-req", messageType: "send-req",
data: { data: {
config: req config: req
} }
}, (message) => { },
message => {
if (message.data.error) { if (message.data.error) {
reject(message.data.error); reject(message.data.error);
} else { } else {
@@ -24,25 +27,30 @@ const chromeWithoutProxy = (req, _store) => new Promise((resolve, reject) => {
); );
}); });
const chromeWithProxy = (req, { state }) => new Promise((resolve, reject) => { const chromeWithProxy = (req, { state }) =>
new Promise((resolve, reject) => {
chrome.runtime.sendMessage( chrome.runtime.sendMessage(
EXTENSION_ID, { EXTENSION_ID,
{
messageType: "send-req", messageType: "send-req",
data: { data: {
config: { config: {
method: "post", method: "post",
url: state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/", url:
state.postwoman.settings.PROXY_URL ||
"https://postwoman.apollotv.xyz/",
data: req data: req
} }
} }
}, (message) => { },
message => {
if (message.data.error) { if (message.data.error) {
reject(error); reject(error);
} else { } else {
resolve(message.data.response.data); resolve(message.data.response.data);
} }
} }
) );
}); });
const chromeStrategy = (req, store) => { const chromeStrategy = (req, store) => {
@@ -51,6 +59,6 @@ const chromeStrategy = (req, store) => {
} else { } else {
return chromeWithoutProxy(req, store); return chromeWithoutProxy(req, store);
} }
} };
export default chromeStrategy; export default chromeStrategy;

View File

@@ -118,7 +118,9 @@ export const mutations = {
addNewCollection({ collections }, collection) { addNewCollection({ collections }, collection) {
const { name } = collection; const { name } = collection;
const duplicateCollection = collections.some(item => item.name.toLowerCase() === name.toLowerCase()); const duplicateCollection = collections.some(
item => item.name.toLowerCase() === name.toLowerCase()
);
if (duplicateCollection) { if (duplicateCollection) {
this.$toast.info("Duplicate collection"); this.$toast.info("Duplicate collection");
return; return;
@@ -139,7 +141,9 @@ export const mutations = {
editCollection({ collections }, payload) { editCollection({ collections }, payload) {
const { collection, collectionIndex } = payload; const { collection, collectionIndex } = payload;
const { name } = collection; const { name } = collection;
const duplicateCollection = collections.some(item => item.name.toLowerCase() === name.toLowerCase()); const duplicateCollection = collections.some(
item => item.name.toLowerCase() === name.toLowerCase()
);
if (duplicateCollection) { if (duplicateCollection) {
this.$toast.info("Duplicate collection"); this.$toast.info("Duplicate collection");
return; return;