Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5950f78

Browse files
authored
Merge pull request #97 from aaroncox/master
Removed reference to authenticator.constructor.name and used new authenticator.getName method
2 parents 036e088 + acd29b7 commit 5950f78

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

__mocks__/Scatter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ export class Scatter extends Authenticator {
128128
}
129129

130130
getName() {
131-
return 'authenticator'
131+
return 'scatter'
132132
}
133133
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ual-reactjs-renderer",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"main": "dist/index.js",
55
"author": {
66
"name": "block.one",

src/components/provider/UALProvider.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export class UALProvider extends Component {
166166
const users = await authenticator.login()
167167
const accountName = await users[0].getAccountName()
168168
if (!isAutoLogin) {
169-
window.localStorage.setItem('UALLoggedInAuthType', authenticator.constructor.name)
169+
window.localStorage.setItem('UALLoggedInAuthType', authenticator.getName())
170170
this.setUALInvalidateAt(authenticator)
171171
}
172172
broadcastStatus({
@@ -194,7 +194,6 @@ export class UALProvider extends Component {
194194
*/
195195
submitAccountForLogin: async (accountInput, authenticator) => {
196196
const { broadcastStatus } = this.state
197-
const authenticatorName = authenticator.constructor.name
198197
broadcastStatus({
199198
loading: true,
200199
message: authenticator.requiresGetKeyConfirmation()
@@ -203,7 +202,7 @@ export class UALProvider extends Component {
203202
})
204203
try {
205204
const users = await authenticator.login(accountInput)
206-
window.localStorage.setItem('UALLoggedInAuthType', authenticatorName)
205+
window.localStorage.setItem('UALLoggedInAuthType', authenticator.getName())
207206
window.localStorage.setItem('UALAccountName', accountInput)
208207
broadcastStatus({
209208
activeUser: users[users.length - 1],
@@ -276,7 +275,7 @@ export class UALProvider extends Component {
276275
* @return {number|boolean}
277276
*/
278277
getAuthenticatorInstance = (type, availableAuthenticators) => {
279-
const loggedIn = availableAuthenticators.filter(auth => auth.constructor.name === type)
278+
const loggedIn = availableAuthenticators.filter(auth => auth.getName() === type)
280279
if (!loggedIn.length) {
281280
this.clearCache()
282281
}

0 commit comments

Comments
 (0)