Skip to content

Commit

Permalink
refactor(Intro): use Facebook type for ctx Authenticate action
Browse files Browse the repository at this point in the history
tymmesyde committed May 10, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 4c86c48 commit 0f4f0f7
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions src/routes/Intro/Intro.js
Original file line number Diff line number Diff line change
@@ -82,32 +82,13 @@ const Intro = ({ queryParams }) => {
openLoaderModal();
getFacebookToken()
.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({
action: 'Ctx',
args: {
action: 'Authenticate',
args: {
type: 'Login',
email,
password,
facebook: true
type: 'Facebook',
token: accessToken,
}
}
});

0 comments on commit 0f4f0f7

Please sign in to comment.