This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use client"; | |
| import { useEffect, useRef } from "react"; | |
| export default function SignOutAction({ deleteTokens }: any) { | |
| const deleteTokensRef = useRef(deleteTokens); | |
| useEffect(() => { | |
| deleteTokensRef.current = deleteTokens; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const getFollowsStream = async ( | |
| userId: number, | |
| accessToken: string, | |
| after: string = "", | |
| follows: any = [] | |
| ) => { | |
| const response = await fetch( | |
| `${TWITCH_URL_API}/streams/followed?user_id=${userId}${ | |
| after ? `&after=${after}` : "" | |
| }`, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const getFollowsDetails = async (ids: any, accessToken: string) => { | |
| const response = await fetch(`${TWITCH_URL_API}/users?${ids}`, { | |
| headers: { | |
| "Client-Id": process.env.NEXT_PUBLIC_CLIENT_ID, | |
| Authorization: "Bearer " + accessToken, | |
| }, | |
| }); | |
| const data = await response.json(); | |
| return data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const getFollows = async ( | |
| userId: number, | |
| accessToken: string, | |
| after: string = "", | |
| follows: any = [] | |
| ): Promise<any> => { | |
| const response = await fetch( | |
| `${TWITCH_URL_API}/users/follows?from_id=${userId}${ | |
| after ? `&after=${after}` : "" | |
| }`, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { getServerSession } from "next-auth"; | |
| import { authOptions } from "./api/auth/[...nextauth]/route"; | |
| import { | |
| getFollows, | |
| getFollowsDetails, | |
| getFollowsStream, | |
| } from "@/api/twitch-api"; | |
| import Topbar from "@/components/topbar.component"; | |
| import ChannelCard from "@/components/channel-card.component"; | |
| import { redirect } from 'next/navigation' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use client"; | |
| import { signIn, useSession } from "next-auth/react"; | |
| import { redirect } from "next/navigation"; | |
| import { BsTwitch } from "react-icons/bs"; | |
| const Login = () => { | |
| const { data: session } = useSession(); | |
| if (session) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default async function RootLayout({ | |
| children, | |
| }: { | |
| children: React.ReactNode; | |
| }) { | |
| const session = await getServerSession(authOptions); | |
| return ( | |
| <html lang="en"> | |
| <body className={inter.className}> | |
| <Provider session={session}>{children}</Provider> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use client' | |
| import { SessionProvider } from "next-auth/react" | |
| export default function Provider ({ | |
| children, | |
| session | |
| }: { | |
| children: React.ReactNode | |
| session: any |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import NextAuth, { AuthOptions } from "next-auth"; | |
| export interface TwitchProfile extends Record<string, any> { | |
| sub: string | |
| preferred_username: string | |
| email: string | |
| picture: string | |
| } | |
| export default function TwitchProvider( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Using min-width | |
| // Small devices (landscape phones, 576px and up) | |
| @media (min-width: 576px) { ... } | |
| // Medium devices (tablets, 768px and up) | |
| @media (min-width: 768px) { ... } | |
| // Large devices (desktops, 992px and up) | |
| @media (min-width: 992px) { ... } |