mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 11:42:05 +00:00
refactor(Intro): use Facebook type for ctx Authenticate action
This commit is contained in:
parent
4c86c48440
commit
0f4f0f7c97
1 changed files with 2 additions and 21 deletions
|
|
@ -82,32 +82,13 @@ const Intro = ({ queryParams }) => {
|
||||||
openLoaderModal();
|
openLoaderModal();
|
||||||
getFacebookToken()
|
getFacebookToken()
|
||||||
.then((accessToken) => {
|
.then((accessToken) => {
|
||||||
return fetch('https://www.strem.io/fb-login-with-token/' + encodeURIComponent(accessToken))
|
|
||||||
.then((resp) => resp.json())
|
|
||||||
.catch(() => {
|
|
||||||
throw new Error('Login failed at getting token from Stremio');
|
|
||||||
})
|
|
||||||
.then(({ user } = {}) => {
|
|
||||||
if (!user || typeof user.email !== 'string' || typeof user.fbLoginToken !== 'string') {
|
|
||||||
throw new Error('Login failed at getting token from Stremio');
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
email: user.email,
|
|
||||||
password: user.fbLoginToken
|
|
||||||
};
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.then(({ email, password }) => {
|
|
||||||
core.transport.dispatch({
|
core.transport.dispatch({
|
||||||
action: 'Ctx',
|
action: 'Ctx',
|
||||||
args: {
|
args: {
|
||||||
action: 'Authenticate',
|
action: 'Authenticate',
|
||||||
args: {
|
args: {
|
||||||
type: 'Login',
|
type: 'Facebook',
|
||||||
email,
|
token: accessToken,
|
||||||
password,
|
|
||||||
facebook: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue