doAuth changes
This commit is contained in:
parent
b96561477a
commit
35df87d1e6
3 changed files with 80 additions and 85 deletions
23
dist/bundle.es.js
vendored
23
dist/bundle.es.js
vendored
|
@ -331,13 +331,7 @@ Lbryio.authenticate = () => {
|
|||
return user;
|
||||
}
|
||||
|
||||
return lbryRedux.Lbry.status().then(status => {
|
||||
if (Lbryio.overrides.setAuthToken) {
|
||||
return Lbryio.overrides.setAuthToken(status);
|
||||
} // simply call the logic to create a new user, and obtain the auth token
|
||||
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
return lbryRedux.Lbry.status().then(status => new Promise((res, rej) => {
|
||||
Lbryio.call('user', 'new', {
|
||||
auth_token: '',
|
||||
language: 'en',
|
||||
|
@ -351,6 +345,10 @@ Lbryio.authenticate = () => {
|
|||
store
|
||||
} = window;
|
||||
|
||||
if (Lbryio.overrides.setAuthToken) {
|
||||
Lbryio.overrides.setAuthToken(response.auth_token);
|
||||
}
|
||||
|
||||
if (store) {
|
||||
store.dispatch({
|
||||
type: GENERATE_AUTH_TOKEN_SUCCESS,
|
||||
|
@ -361,16 +359,15 @@ Lbryio.authenticate = () => {
|
|||
}
|
||||
|
||||
Lbryio.authToken = response.auth_token;
|
||||
res(response);
|
||||
return res(response);
|
||||
}).catch(error => rej(error));
|
||||
});
|
||||
});
|
||||
}).then(user => {
|
||||
if (!user) {
|
||||
})).then(newUser => {
|
||||
if (!newUser) {
|
||||
return Lbryio.getCurrentUser();
|
||||
}
|
||||
|
||||
return user;
|
||||
return newUser;
|
||||
});
|
||||
}).then(resolve, reject);
|
||||
});
|
||||
}
|
||||
|
|
19
dist/bundle.js
vendored
19
dist/bundle.js
vendored
|
@ -644,11 +644,6 @@ Lbryio.authenticate = function () {
|
|||
}
|
||||
|
||||
return lbry_redux__WEBPACK_IMPORTED_MODULE_1__["Lbry"].status().then(function (status) {
|
||||
if (Lbryio.overrides.setAuthToken) {
|
||||
return Lbryio.overrides.setAuthToken(status);
|
||||
} // simply call the logic to create a new user, and obtain the auth token
|
||||
|
||||
|
||||
return new Promise(function (res, rej) {
|
||||
Lbryio.call('user', 'new', {
|
||||
auth_token: '',
|
||||
|
@ -662,6 +657,10 @@ Lbryio.authenticate = function () {
|
|||
var _window2 = window,
|
||||
store = _window2.store;
|
||||
|
||||
if (Lbryio.overrides.setAuthToken) {
|
||||
Lbryio.overrides.setAuthToken(response.auth_token);
|
||||
}
|
||||
|
||||
if (store) {
|
||||
store.dispatch({
|
||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GENERATE_AUTH_TOKEN_SUCCESS"],
|
||||
|
@ -672,18 +671,18 @@ Lbryio.authenticate = function () {
|
|||
}
|
||||
|
||||
Lbryio.authToken = response.auth_token;
|
||||
res(response);
|
||||
return res(response);
|
||||
})["catch"](function (error) {
|
||||
return rej(error);
|
||||
});
|
||||
});
|
||||
});
|
||||
}).then(function (user) {
|
||||
if (!user) {
|
||||
}).then(function (newUser) {
|
||||
if (!newUser) {
|
||||
return Lbryio.getCurrentUser();
|
||||
}
|
||||
|
||||
return user;
|
||||
return newUser;
|
||||
});
|
||||
}).then(resolve, reject);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -136,13 +136,10 @@ Lbryio.authenticate = () => {
|
|||
return user;
|
||||
}
|
||||
|
||||
return Lbry.status().then(status => {
|
||||
if (Lbryio.overrides.setAuthToken) {
|
||||
return Lbryio.overrides.setAuthToken(status);
|
||||
}
|
||||
|
||||
// simply call the logic to create a new user, and obtain the auth token
|
||||
return new Promise((res, rej) => {
|
||||
return Lbry.status()
|
||||
.then(
|
||||
status =>
|
||||
new Promise((res, rej) => {
|
||||
Lbryio.call(
|
||||
'user',
|
||||
'new',
|
||||
|
@ -159,26 +156,28 @@ Lbryio.authenticate = () => {
|
|||
}
|
||||
|
||||
const { store } = window;
|
||||
if (Lbryio.overrides.setAuthToken) {
|
||||
Lbryio.overrides.setAuthToken(response.auth_token);
|
||||
}
|
||||
|
||||
if (store) {
|
||||
store.dispatch({
|
||||
type: ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS,
|
||||
data: { authToken: response.auth_token },
|
||||
});
|
||||
}
|
||||
|
||||
Lbryio.authToken = response.auth_token;
|
||||
res(response);
|
||||
return res(response);
|
||||
})
|
||||
.catch(error => rej(error));
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(user => {
|
||||
if (!user) {
|
||||
)
|
||||
.then(newUser => {
|
||||
if (!newUser) {
|
||||
return Lbryio.getCurrentUser();
|
||||
}
|
||||
|
||||
return user;
|
||||
return newUser;
|
||||
});
|
||||
})
|
||||
.then(resolve, reject);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue