Comparing version
@@ -27,3 +27,3 @@ import type { AxiosResponse, ResponseType, Method } from "axios"; | ||
onUploadProgress?: (progress: number, event: ProgressEvent) => void; | ||
loginFn?: () => Promise<void>; | ||
loginFn?: (config?: RequestConfig) => Promise<void>; | ||
}; | ||
@@ -30,0 +30,0 @@ /** |
@@ -231,4 +231,6 @@ "use strict"; | ||
// Try logging in again. | ||
await config.loginFn(); | ||
return await this.executeRequest(config); | ||
await config.loginFn(config); | ||
// Unset the login function on the recursive call so that we don't try | ||
// to login again, avoiding infinite loops. | ||
return await this.executeRequest({ ...config, loginFn: undefined }); | ||
} | ||
@@ -235,0 +237,0 @@ else { |
@@ -256,5 +256,5 @@ export type { CustomConnectorOptions } from "./connector"; | ||
* 1. SDK opens MySky on the same portal as the skapp. | ||
* 2. If the preferred portal is found in localstorage, MySky connects to it | ||
* and we go to step 5. | ||
* 3. Else, MySky connects to siasky.net. | ||
* 2. If a seed was not found, no preferred portal can be found, so exit the | ||
* flow. | ||
* 3. MySky connects to siasky.net first. | ||
* 4. MySky tries to get the saved portal preference. | ||
@@ -273,3 +273,3 @@ * 1. If the portal is set, MySky switches to using the preferred portal. | ||
* 1. SDK logs in through the UI. | ||
* 2. MySky UI switches to siasky.net and tries to get the saved portal | ||
* 2. MySky switches to siasky.net and tries to get the saved portal | ||
* preference. | ||
@@ -276,0 +276,0 @@ * 1. If the portal is set, MySky switches to using the preferred portal. |
@@ -128,3 +128,6 @@ "use strict"; | ||
let domain = exports.MYSKY_DOMAIN; | ||
if (opts.alpha) { | ||
if (opts.alpha && opts.dev) { | ||
throw new Error(`Cannot redirect to both Alpha MySky Domain and Dev MySky Domain. Please pass either the 'dev' or the 'alpha' option, not both.`); | ||
} | ||
else if (opts.alpha) { | ||
domain = exports.MYSKY_ALPHA_DOMAIN; | ||
@@ -511,2 +514,5 @@ } | ||
// this.connector.client.customOptions.loginFn = this.portalLogin; | ||
// } else { | ||
// // Clear the old login function. | ||
// this.connector.client.customOptions.loginFn = undefined; | ||
// } | ||
@@ -538,5 +544,5 @@ // } catch (e) { | ||
* 1. SDK opens MySky on the same portal as the skapp. | ||
* 2. If the preferred portal is found in localstorage, MySky connects to it | ||
* and we go to step 5. | ||
* 3. Else, MySky connects to siasky.net. | ||
* 2. If a seed was not found, no preferred portal can be found, so exit the | ||
* flow. | ||
* 3. MySky connects to siasky.net first. | ||
* 4. MySky tries to get the saved portal preference. | ||
@@ -555,3 +561,3 @@ * 1. If the portal is set, MySky switches to using the preferred portal. | ||
* 1. SDK logs in through the UI. | ||
* 2. MySky UI switches to siasky.net and tries to get the saved portal | ||
* 2. MySky switches to siasky.net and tries to get the saved portal | ||
* preference. | ||
@@ -558,0 +564,0 @@ * 1. If the portal is set, MySky switches to using the preferred portal. |
@@ -27,3 +27,3 @@ import type { AxiosResponse, ResponseType, Method } from "axios"; | ||
onUploadProgress?: (progress: number, event: ProgressEvent) => void; | ||
loginFn?: () => Promise<void>; | ||
loginFn?: (config?: RequestConfig) => Promise<void>; | ||
}; | ||
@@ -30,0 +30,0 @@ /** |
@@ -225,4 +225,6 @@ import axios from "axios"; | ||
// Try logging in again. | ||
await config.loginFn(); | ||
return await this.executeRequest(config); | ||
await config.loginFn(config); | ||
// Unset the login function on the recursive call so that we don't try | ||
// to login again, avoiding infinite loops. | ||
return await this.executeRequest({ ...config, loginFn: undefined }); | ||
} | ||
@@ -229,0 +231,0 @@ else { |
@@ -256,5 +256,5 @@ export type { CustomConnectorOptions } from "./connector"; | ||
* 1. SDK opens MySky on the same portal as the skapp. | ||
* 2. If the preferred portal is found in localstorage, MySky connects to it | ||
* and we go to step 5. | ||
* 3. Else, MySky connects to siasky.net. | ||
* 2. If a seed was not found, no preferred portal can be found, so exit the | ||
* flow. | ||
* 3. MySky connects to siasky.net first. | ||
* 4. MySky tries to get the saved portal preference. | ||
@@ -273,3 +273,3 @@ * 1. If the portal is set, MySky switches to using the preferred portal. | ||
* 1. SDK logs in through the UI. | ||
* 2. MySky UI switches to siasky.net and tries to get the saved portal | ||
* 2. MySky switches to siasky.net and tries to get the saved portal | ||
* preference. | ||
@@ -276,0 +276,0 @@ * 1. If the portal is set, MySky switches to using the preferred portal. |
@@ -123,3 +123,6 @@ /* istanbul ignore file: Much of this functionality is only testable from a browser */ | ||
let domain = MYSKY_DOMAIN; | ||
if (opts.alpha) { | ||
if (opts.alpha && opts.dev) { | ||
throw new Error(`Cannot redirect to both Alpha MySky Domain and Dev MySky Domain. Please pass either the 'dev' or the 'alpha' option, not both.`); | ||
} | ||
else if (opts.alpha) { | ||
domain = MYSKY_ALPHA_DOMAIN; | ||
@@ -506,2 +509,5 @@ } | ||
// this.connector.client.customOptions.loginFn = this.portalLogin; | ||
// } else { | ||
// // Clear the old login function. | ||
// this.connector.client.customOptions.loginFn = undefined; | ||
// } | ||
@@ -533,5 +539,5 @@ // } catch (e) { | ||
* 1. SDK opens MySky on the same portal as the skapp. | ||
* 2. If the preferred portal is found in localstorage, MySky connects to it | ||
* and we go to step 5. | ||
* 3. Else, MySky connects to siasky.net. | ||
* 2. If a seed was not found, no preferred portal can be found, so exit the | ||
* flow. | ||
* 3. MySky connects to siasky.net first. | ||
* 4. MySky tries to get the saved portal preference. | ||
@@ -550,3 +556,3 @@ * 1. If the portal is set, MySky switches to using the preferred portal. | ||
* 1. SDK logs in through the UI. | ||
* 2. MySky UI switches to siasky.net and tries to get the saved portal | ||
* 2. MySky switches to siasky.net and tries to get the saved portal | ||
* preference. | ||
@@ -553,0 +559,0 @@ * 1. If the portal is set, MySky switches to using the preferred portal. |
{ | ||
"name": "skynet-js", | ||
"version": "4.0.26-beta", | ||
"version": "4.0.27-beta", | ||
"description": "Sia Skynet Javascript Client", | ||
@@ -87,3 +87,3 @@ "main": "dist/cjs/index.js", | ||
"eslint": "^7.11.0", | ||
"eslint-plugin-jsdoc": "^37.0.3", | ||
"eslint-plugin-jsdoc": "^38.0.3", | ||
"husky": "^6.0.0", | ||
@@ -90,0 +90,0 @@ "jest": "^26.6.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
894625
0.12%18547
0.09%