You've already forked DataMate
feat: fix the problem in the Operator Market frontend pages
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
|
||||
function log(message, type = "log", provided = 'console') {
|
||||
const providedFn = globalThis[provided] || console;
|
||||
if (providedFn && typeof providedFn[type] === 'function') {
|
||||
const invokeMethod = providedFn[type ?? 'log'];
|
||||
invokeMethod.call(providedFn, message);
|
||||
}
|
||||
}
|
||||
|
||||
function addMockPrefix(urlPrefix, api) {
|
||||
const newMockApi = {};
|
||||
Object.keys(api).map(apiKey=>{
|
||||
newMockApi[apiKey] = urlPrefix + api[apiKey];
|
||||
});
|
||||
|
||||
return new Proxy(newMockApi, {
|
||||
get(target, prop) {
|
||||
if (prop in target) {
|
||||
return target[prop];
|
||||
} else {
|
||||
throw new Error(`API ${String(prop)} is not defined.`);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
log,
|
||||
addMockPrefix,
|
||||
|
||||
function log(message, type = "log", provided = 'console') {
|
||||
const providedFn = globalThis[provided] || console;
|
||||
if (providedFn && typeof providedFn[type] === 'function') {
|
||||
const invokeMethod = providedFn[type ?? 'log'];
|
||||
invokeMethod.call(providedFn, message);
|
||||
}
|
||||
}
|
||||
|
||||
function addMockPrefix(urlPrefix, api) {
|
||||
const newMockApi = {};
|
||||
Object.keys(api).map(apiKey=>{
|
||||
newMockApi[apiKey] = urlPrefix + api[apiKey];
|
||||
});
|
||||
|
||||
return new Proxy(newMockApi, {
|
||||
get(target, prop) {
|
||||
if (prop in target) {
|
||||
return target[prop];
|
||||
} else {
|
||||
throw new Error(`API ${String(prop)} is not defined.`);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
log,
|
||||
addMockPrefix,
|
||||
};
|
||||
Reference in New Issue
Block a user