From 0f4f0f7c978ee9642c1fa4fa3c3589e4287538e0 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 May 2024 14:31:06 +0200 Subject: [PATCH] refactor(Intro): use Facebook type for ctx Authenticate action --- src/routes/Intro/Intro.js | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/routes/Intro/Intro.js b/src/routes/Intro/Intro.js index 908499a8b..cde07bc96 100644 --- a/src/routes/Intro/Intro.js +++ b/src/routes/Intro/Intro.js @@ -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, } } });