diff --git a/src/components/layouts/collection-page-layout.tsx b/src/components/layouts/collection-page-layout.tsx index cea5bd15e..f4b13cf5e 100644 --- a/src/components/layouts/collection-page-layout.tsx +++ b/src/components/layouts/collection-page-layout.tsx @@ -495,9 +495,9 @@ const CollectionPageLayout: React.FunctionComponent< {/* TODO: fix bookmarks feature EGG-294 */} {/* Start of action buttons block */} - {/*
*/} - {/* Bookmark button */} - {/* {toggle_favorite_url ? ( +
+ {/* Bookmark button */} + {toggle_favorite_url ? (
*/} +
{/* End of action buttons block */}
diff --git a/src/hooks/use-cio.tsx b/src/hooks/use-cio.tsx index 2e33c6fe7..b5e54f5c5 100644 --- a/src/hooks/use-cio.tsx +++ b/src/hooks/use-cio.tsx @@ -55,6 +55,7 @@ export const CioProvider: React.FunctionComponent< setSubscriber(data) cioIdentify(data.id) }) + .catch(() => {}) .finally(() => setLoadingSubscriber(false)) }, []) diff --git a/src/lib/playlists.ts b/src/lib/playlists.ts index be87fcb48..8f6dc530b 100644 --- a/src/lib/playlists.ts +++ b/src/lib/playlists.ts @@ -155,6 +155,8 @@ export async function loadPlaylist(slug: string, token?: string) { published_at access_state visibility_state + toggle_favorite_url + favorited state tags { name @@ -294,6 +296,8 @@ export async function loadPlaylist(slug: string, token?: string) { slug: slug, } + console.log('query', token) + const graphQLClient = getGraphQLClient(token) const {playlist} = await graphQLClient.request(query, variables) diff --git a/src/pages/api/cio/identify/[id].ts b/src/pages/api/cio/identify/[id].ts index c9f3166e2..7c7b4abc1 100644 --- a/src/pages/api/cio/identify/[id].ts +++ b/src/pages/api/cio/identify/[id].ts @@ -34,11 +34,13 @@ const cioIdentify = async (req: NextApiRequest, res: NextApiResponse) => { Authorization: `Basic ${ENCODED_CUSTOMER_IO_TRACKING_API_CREDENTIALS}`, } - await axios.put( - `https://track.customer.io/api/v1/customers/${id}`, - {...options, _update: true}, - {headers}, - ) + await axios + .put( + `https://track.customer.io/api/v1/customers/${id}`, + {...options, _update: true}, + {headers}, + ) + .catch(() => {}) const cioCookie = serverCookie.serialize(CIO_IDENTIFIER_KEY, id, { secure: process.env.NODE_ENV === 'production', diff --git a/src/pages/courses/[course]/index.tsx b/src/pages/courses/[course]/index.tsx index 8b7fba55c..575de7269 100644 --- a/src/pages/courses/[course]/index.tsx +++ b/src/pages/courses/[course]/index.tsx @@ -118,7 +118,12 @@ export const getServerSideProps: GetServerSideProps = async ({ }) => { setupHttpTracing({name: getServerSideProps.name, tracer, req, res}) try { - const course = params && (await loadPlaylist(params.course as string)) + const course = + params && + (await loadPlaylist( + params.course as string, + req.cookies[ACCESS_TOKEN_KEY], + )) const courseSlug = getSlugFromPath(course?.path) if (course && courseSlug !== params?.course) { diff --git a/src/utils/analytics/identify.ts b/src/utils/analytics/identify.ts index 66bcb23c1..91a2971e9 100644 --- a/src/utils/analytics/identify.ts +++ b/src/utils/analytics/identify.ts @@ -36,7 +36,7 @@ export const identify = async (data: Viewer, properties?: any) => { mixpanel.opt_out_tracking() } } catch (e) { - console.error('caught error in identify', e) + // console.error('caught error in identify', e) return Promise.resolve(false) } diff --git a/src/utils/analytics/track.ts b/src/utils/analytics/track.ts index 5384baabd..fe80fa31c 100644 --- a/src/utils/analytics/track.ts +++ b/src/utils/analytics/track.ts @@ -2,7 +2,6 @@ import {isFunction, isUndefined} from 'lodash' import {Viewer} from '@/types' import Auth from '../auth' import mixpanel from 'mixpanel-browser' -import posthog from 'posthog-js' import {identify} from './identify' import PosthogClient from '@/lib/posthog-client' const DEBUG_ANALYTICS = true @@ -77,13 +76,13 @@ export const track = ( try { window._cio.track(event, params) } catch (e) { - console.error('caught error', e) + // console.error('caught error', e) } } politelyExit() } catch (e) { - console.error('caught error', e) + // console.error('caught error', e) resolve(false) } })