Page MenuHomePhorge

D9711.1768973721.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D9711.1768973721.diff

diff --git a/lib/utils/action-utils.js b/lib/utils/action-utils.js
--- a/lib/utils/action-utils.js
+++ b/lib/utils/action-utils.js
@@ -240,7 +240,7 @@
) => {
const startingPayload = { ...inputStartingPayload, logInActionSource };
dispatch(wrapActionPromise(actionTypes, promise, null, startingPayload));
- return new Promise(r => (callServerEndpointCallback = r));
+ return new Promise<boolean>(r => (callServerEndpointCallback = r));
};
await resolveInvalidatedCookie(
boundCallServerEndpoint,
@@ -291,7 +291,9 @@
return Promise.resolve(null);
}
// Wait to run until we get our new cookie
- return new Promise(r => serverEndpointCallsWaitingForNewCookie.push(r));
+ return new Promise<?CallServerEndpoint>(r =>
+ serverEndpointCallsWaitingForNewCookie.push(r),
+ );
};
// This function is a helper for the next function defined below
const attemptToResolveInvalidation = async (
@@ -337,7 +339,9 @@
return Promise.resolve(null);
}
if (currentlyWaitingForNewCookie) {
- return new Promise(r => serverEndpointCallsWaitingForNewCookie.push(r));
+ return new Promise<?CallServerEndpoint>(r =>
+ serverEndpointCallsWaitingForNewCookie.push(r),
+ );
}
currentlyWaitingForNewCookie = true;
return attemptToResolveInvalidation(sessionChange);
diff --git a/lib/utils/blob-service-upload.js b/lib/utils/blob-service-upload.js
--- a/lib/utils/blob-service-upload.js
+++ b/lib/utils/blob-service-upload.js
@@ -42,7 +42,7 @@
}
let failed = false;
- const responsePromise = new Promise((resolve, reject) => {
+ const responsePromise = new Promise<void>((resolve, reject) => {
xhr.onload = () => {
if (failed) {
return;
diff --git a/lib/utils/upload-blob.js b/lib/utils/upload-blob.js
--- a/lib/utils/upload-blob.js
+++ b/lib/utils/upload-blob.js
@@ -67,41 +67,43 @@
}
let failed = false;
- const responsePromise = new Promise((resolve, reject) => {
- xhr.onload = () => {
- if (failed) {
- return;
- }
- const text = xhr.responseText;
- try {
- resolve(JSON.parse(text));
- } catch (e) {
- console.log(text);
- reject(e);
- }
- };
- xhr.onabort = () => {
- failed = true;
- reject(new Error('request aborted'));
- };
- xhr.onerror = event => {
- failed = true;
- reject(event);
- };
- if (options && options.timeout) {
- xhr.ontimeout = event => {
- failed = true;
- reject(event);
+ const responsePromise = new Promise<CallServerEndpointResponse>(
+ (resolve, reject) => {
+ xhr.onload = () => {
+ if (failed) {
+ return;
+ }
+ const text = xhr.responseText;
+ try {
+ resolve(JSON.parse(text));
+ } catch (e) {
+ console.log(text);
+ reject(e);
+ }
};
- }
- if (options && options.abortHandler) {
- options.abortHandler(() => {
+ xhr.onabort = () => {
failed = true;
reject(new Error('request aborted'));
- xhr.abort();
- });
- }
- });
+ };
+ xhr.onerror = event => {
+ failed = true;
+ reject(event);
+ };
+ if (options && options.timeout) {
+ xhr.ontimeout = event => {
+ failed = true;
+ reject(event);
+ };
+ }
+ if (options && options.abortHandler) {
+ options.abortHandler(() => {
+ failed = true;
+ reject(new Error('request aborted'));
+ xhr.abort();
+ });
+ }
+ },
+ );
if (!failed) {
xhr.send(formData);

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 21, 5:35 AM (4 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5966806
Default Alt Text
D9711.1768973721.diff (3 KB)

Event Timeline