diff --git a/src/routes/Settings/Settings.js b/src/routes/Settings/Settings.js index c90b7150e..fe11e82bd 100644 --- a/src/routes/Settings/Settings.js +++ b/src/routes/Settings/Settings.js @@ -75,8 +75,11 @@ const Settings = () => { }); }, []); const authenticateTraktOnClick = React.useCallback(() => { - // TODO - }, []); + if (profile.auth !== null && profile.auth.user !== null && profile.auth.user.trakt === null && typeof profile.auth.user._id === 'string') { + const auth_url = `https://www.strem.io/trakt/auth/${profile.auth.user._id}`; + window.open(auth_url); + } + }, [profile.auth]); const importFacebookOnClick = React.useCallback(() => { // TODO }, []); @@ -130,6 +133,16 @@ const Settings = () => { const sectionsContainerOnScorll = React.useCallback(throttle(() => { updateSelectedSectionId(); }, 50), []); + React.useEffect(() => { + if (profile.auth !== null && profile.auth.user !== null && profile.auth.user.trakt !== null) { + core.transport.dispatch({ + action: 'Ctx', + args: { + action: 'InstallTraktAddon' + } + }); + } + }, [profile.auth]); React.useEffect(() => { if (dataExport.exportUrl !== null && typeof dataExport.exportUrl === 'string') { window.open(dataExport.exportUrl); @@ -223,9 +236,10 @@ const Settings = () => {