Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Commit

Permalink
refactor: change default redirectUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
dudiq authored and Alex committed Apr 16, 2019
1 parent 06cb31b commit d0bcb80
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@endpass/connect",
"version": "0.17.6-beta",
"version": "0.17.7-beta",
"authVersion": "",
"main": "./dist/endpass-connect.min.js",
"module": "./dist/endpass-connect.esm.js",
Expand Down Expand Up @@ -67,7 +67,7 @@
}
},
"dependencies": {
"@endpass/class": "^0.10.3",
"@endpass/class": "^0.10.4",
"lodash.get": "^4.4.2",
"utility-types": "^3.4.1",
"web3-providers-http": "1.0.0-beta.33"
Expand Down
7 changes: 5 additions & 2 deletions src/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,14 @@ export default class Context {
* @returns {Promise<boolean>} Auth result, check `status` property to
* know about result
*/
async auth(redirectUrl = window.location.origin) {
async auth(redirectUrl) {
const toPath =
redirectUrl || `${window.location.origin}${window.location.pathname}`;

const res = await this.askDialog({
method: METHODS.AUTH,
payload: {
redirectUrl,
redirectUrl: toPath,
},
});

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/spec/Context.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('Context class', () => {
const res = await context.auth();

expect(bridge.ask).toBeCalledWith(METHODS.AUTH, {
redirectUrl: 'http://localhost',
redirectUrl: 'http://localhost/',
});
expect(res).toEqual(dialogResponse);
});
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -921,12 +921,12 @@
dependencies:
find-up "^2.1.0"

"@endpass/class@^0.10.3":
version "0.10.3"
resolved "https://registry.yarnpkg.com/@endpass/class/-/class-0.10.3.tgz#d92c4d3d37dc1249ecfe815a1d657a7b1162e095"
integrity sha512-auJYa340yqY9g8nUPKEIvZ+fySda6R7rO7R4RNkqeSNDHrXEhCoLpjQHnvLhtEnvgQqwOllqIMSWWam95oSISQ==
"@endpass/class@^0.10.4":
version "0.10.4"
resolved "https://registry.yarnpkg.com/@endpass/class/-/class-0.10.4.tgz#21b3fae81d0a0b8d24a9aa9bc80589e6810493b9"
integrity sha512-Zrn0VmfhSKSNGd80j9BQTOK229jC/Kme15A/IvkDofR0PtxtO1d9skQ/SCrOHVNTgc74KVj54C13+0OV/Zi/Bw==
dependencies:
"@endpass/utils" "^1.2.3"
"@endpass/utils" "^1.3.5"
"@ledgerhq/hw-app-eth" "^4.24.0"
"@ledgerhq/hw-transport-u2f" "^4.24.0"
bignumber.js "^7.2.1"
Expand All @@ -943,10 +943,10 @@
web3-providers-ws "1.0.0-beta.33"
web3-utils "1.0.0-beta.33"

"@endpass/utils@^1.2.3":
version "1.2.3"
resolved "https://registry.yarnpkg.com/@endpass/utils/-/utils-1.2.3.tgz#6fa0104b84feab666208f1e016c0f0e23598b672"
integrity sha512-h/bVkeAilCF8DIbgKAiEfW4WuoUkaPzTGVUAnutsecwGJ2XQJufOJjJlJVqTmT8DZGcvWuY1nd1jx7stA1a8/g==
"@endpass/utils@^1.3.5":
version "1.3.5"
resolved "https://registry.yarnpkg.com/@endpass/utils/-/utils-1.3.5.tgz#d1f51a734dc347a0d306877475302182c68bb505"
integrity sha512-2A+zQV1uk7Q8l2kmw41VZgB82FzWdjmAi2EC0RICHmUqLMj/0e8UdtaExyNOIVWha469u6y5DT6Ox19nmtDdow==
dependencies:
bs58check "^2.1.2"
dayjs "^1.7.8"
Expand Down

0 comments on commit d0bcb80

Please sign in to comment.