More robust fix
This commit is contained in:
parent
b62cd98f67
commit
3951f01422
|
@ -49,7 +49,9 @@ export const requestPlugin: Cosmos.Plugin<any> = async (requestContext, next) =>
|
||||||
|
|
||||||
export const endpoint = () => {
|
export const endpoint = () => {
|
||||||
if (config.platform === Platform.Emulator) {
|
if (config.platform === Platform.Emulator) {
|
||||||
return config.EMULATOR_ENDPOINT || window.parent.location.origin;
|
// In worker scope, _global(self).parent does not exist
|
||||||
|
const location = _global.parent ? _global.parent.location : _global.location;
|
||||||
|
return config.EMULATOR_ENDPOINT || location.origin;
|
||||||
}
|
}
|
||||||
return _endpoint || (_databaseAccount && _databaseAccount.properties && _databaseAccount.properties.documentEndpoint);
|
return _endpoint || (_databaseAccount && _databaseAccount.properties && _databaseAccount.properties.documentEndpoint);
|
||||||
};
|
};
|
||||||
|
|
|
@ -106,6 +106,7 @@ function createDocumentsFromFile(fileName: string, documentContent: string): voi
|
||||||
triggerCreateDocument(content);
|
triggerCreateDocument(content);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
recordUploadDetailErrorForFile(fileName, e.message);
|
recordUploadDetailErrorForFile(fileName, e.message);
|
||||||
transmitResultIfUploadComplete();
|
transmitResultIfUploadComplete();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue