feat: account
This commit is contained in:
1 parent
df0f7c943b
commit
043375f44a
17 files changed
+305
-131
No files matched your search
+73
-18
@@ -1,28 +1,83 @@
|
|||||||
|
type Search = Record<string, string | number | boolean | null | undefined>;
|
||||||
|
|
||||||
class Http {
|
class Http {
|
||||||
private base = 'https://api.themoviedb.org/3';
|
private readonly base = 'https://api.themoviedb.org/3';
|
||||||
|
|
||||||
|
private async request<T, B = unknown>({
|
||||||
|
method,
|
||||||
|
url,
|
||||||
|
base = this.base,
|
||||||
|
search,
|
||||||
|
body,
|
||||||
|
preventCache = true
|
||||||
|
}: {
|
||||||
|
method: 'GET' | 'POST';
|
||||||
|
url: string;
|
||||||
|
base?: string;
|
||||||
|
search?: Search;
|
||||||
|
body?: B;
|
||||||
|
preventCache?: boolean;
|
||||||
|
}): Promise<T> {
|
||||||
|
const serializedParams = new URLSearchParams(
|
||||||
|
Object.entries(search ?? {}).reduce((params, [key, value]) => {
|
||||||
|
if (value != null && value !== '') {
|
||||||
|
params.set(key, String(value));
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}, new URLSearchParams())
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${base}${url}?${serializedParams}`, {
|
||||||
|
method,
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.MOVIE_DB_TOKEN}`,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: body ? JSON.stringify(body) : undefined,
|
||||||
|
next: preventCache ? undefined : { revalidate: 3600 }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
return Promise.reject({
|
||||||
|
status: response.status,
|
||||||
|
statusText: response.statusText
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
} catch (error) {
|
||||||
|
return Promise.reject({ message: 'Network or parsing error', error });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get<T>(
|
get<T>(
|
||||||
url: string,
|
url: string,
|
||||||
{ params, force }: { params?: Record<string, unknown>; force?: boolean } = {},
|
{ params, preventCache }: { params?: Search; preventCache?: boolean } = {},
|
||||||
base?: string
|
base?: string
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
const serializedParams = Object.entries(params || {}).reduce((params, [key, value]) => {
|
return this.request<T>({
|
||||||
if (!['', undefined, null].includes(value as string)) {
|
url,
|
||||||
params.set(key, value as string);
|
method: 'GET',
|
||||||
}
|
search: params,
|
||||||
|
preventCache,
|
||||||
|
base
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return params;
|
post<T, B = unknown>(
|
||||||
}, new URLSearchParams());
|
url: string,
|
||||||
|
{ params, preventCache }: { params?: Search; preventCache?: boolean } = {},
|
||||||
return fetch(`${base || this.base}${url}?${serializedParams}`, {
|
body?: B,
|
||||||
headers: {
|
base?: string
|
||||||
Authorization: `Bearer ${process.env.MOVIE_DB_TOKEN}`
|
): Promise<T> {
|
||||||
},
|
return this.request<T>({
|
||||||
next: force ? undefined : { revalidate: 3600 }
|
url,
|
||||||
}).then((response) => {
|
method: 'POST',
|
||||||
if (!response.ok) return Promise.reject(response);
|
search: params,
|
||||||
|
body,
|
||||||
return response.json();
|
base,
|
||||||
|
preventCache
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-2
@@ -7,11 +7,42 @@ import pirateBay from './parsers/pirate-bay';
|
|||||||
import yts from './parsers/yts';
|
import yts from './parsers/yts';
|
||||||
import http from './Http';
|
import http from './Http';
|
||||||
import { Sort } from './parsers';
|
import { Sort } from './parsers';
|
||||||
|
import { cookies } from 'next/headers';
|
||||||
|
|
||||||
export const createRequestToken = async () => {
|
export const createRequestToken = async () => {
|
||||||
|
return http.get<RequestToken>('/authentication/token/new', { preventCache: true }).then(({ request_token }) => ({
|
||||||
|
redirectUrl: `https://www.themoviedb.org/authenticate/${request_token}`,
|
||||||
|
requestToken: request_token
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createSession = async ({ requestToken }: { requestToken: string }) => {
|
||||||
|
return http.post<Session>('/authentication/session/new', {
|
||||||
|
params: { request_token: requestToken },
|
||||||
|
preventCache: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const account = async () => {
|
||||||
|
return http.get<Account>('/account/null', {
|
||||||
|
params: { session_id: cookies().get('session')?.value },
|
||||||
|
preventCache: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const usersShows = async ({
|
||||||
|
showType,
|
||||||
|
listType
|
||||||
|
}: {
|
||||||
|
showType: Show['type'];
|
||||||
|
listType: 'favorites' | 'watchlist';
|
||||||
|
}): Promise<Pagination<Show>> => {
|
||||||
return http
|
return http
|
||||||
.get<RequestToken>('/authentication/token/new', { force: true })
|
.get<TMDBPagination<Movie>>(`/account/null/${listType}/${showType === 'tv' ? 'tv' : 'movies'}`, {
|
||||||
.then(({ request_token }) => request_token);
|
params: { session_id: cookies().get('session')?.value },
|
||||||
|
preventCache: true
|
||||||
|
})
|
||||||
|
.then((response) => mapMoviesSeriesResponseToShows(response, showType));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const search = async ({
|
export const search = async ({
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import { NextRequest, NextResponse } from 'next/server';
|
|
||||||
|
|
||||||
import broadcaster from '@/lib/broadcaster';
|
|
||||||
|
|
||||||
export async function GET({ nextUrl }: NextRequest) {
|
|
||||||
const requestToken = nextUrl.searchParams.get('request_token');
|
|
||||||
|
|
||||||
broadcaster.emit('approve', requestToken);
|
|
||||||
|
|
||||||
return NextResponse.json({ requestToken });
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import { NextRequest } from 'next/server';
|
|
||||||
|
|
||||||
import broadcaster from '@/lib/broadcaster';
|
|
||||||
|
|
||||||
export async function GET(req: NextRequest) {
|
|
||||||
const headers = new Headers();
|
|
||||||
|
|
||||||
headers.set('Content-Type', 'text/event-stream');
|
|
||||||
headers.set('Cache-Control', 'no-cache');
|
|
||||||
headers.set('Connection', 'keep-alive');
|
|
||||||
|
|
||||||
const stream = new ReadableStream({
|
|
||||||
start(controller) {
|
|
||||||
const emit = (token: string) => {
|
|
||||||
controller.enqueue(new TextEncoder().encode(`data: ${token}\n\n`));
|
|
||||||
};
|
|
||||||
|
|
||||||
broadcaster.on('approve', emit);
|
|
||||||
|
|
||||||
req.signal.addEventListener('abort', () => {
|
|
||||||
broadcaster.off('approve', emit);
|
|
||||||
controller.close();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return new Response(stream, {
|
|
||||||
headers
|
|
||||||
});
|
|
||||||
}
|
|
||||||
+1
-1
@@ -22,7 +22,7 @@ export const viewport: Viewport = {
|
|||||||
userScalable: false
|
userScalable: false
|
||||||
};
|
};
|
||||||
|
|
||||||
const font = Poppins({ subsets: ['latin'], weight: '400' });
|
const font = Poppins({ subsets: ['latin'], weight: ['400', '500', '600'] });
|
||||||
|
|
||||||
const RootLayout = ({ children }: { children: ReactNode }) => {
|
const RootLayout = ({ children }: { children: ReactNode }) => {
|
||||||
const theme = cookies().get('theme')?.value as Theme;
|
const theme = cookies().get('theme')?.value as Theme;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { UserRound } from 'lucide-react';
|
import { LogIn,LogOut, User as UserIcon, UserRound } from 'lucide-react';
|
||||||
|
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import {
|
import {
|
||||||
@@ -8,15 +8,19 @@ import {
|
|||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuGroup,
|
DropdownMenuGroup,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuLabel,
|
|
||||||
DropdownMenuSeparator,
|
DropdownMenuSeparator,
|
||||||
DropdownMenuTrigger
|
DropdownMenuTrigger
|
||||||
} from '@/components/ui/dropdown-menu';
|
} from '@/components/ui/dropdown-menu';
|
||||||
|
import useAccount from '@/hooks/useAccount';
|
||||||
|
|
||||||
import useAuth from './useAuth';
|
import useAuth from './useAuth';
|
||||||
|
import useLogOut from './useLogOut';
|
||||||
|
|
||||||
const User = () => {
|
const User = () => {
|
||||||
|
const account = useAccount();
|
||||||
|
|
||||||
const auth = useAuth();
|
const auth = useAuth();
|
||||||
|
const logOut = useLogOut();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
@@ -27,12 +31,29 @@ const User = () => {
|
|||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent>
|
<DropdownMenuContent>
|
||||||
<DropdownMenuGroup>
|
<DropdownMenuGroup>
|
||||||
<DropdownMenuItem className='flex justify-center text-center' onClick={() => auth.mutate()}>
|
{account ? (
|
||||||
Log in
|
<>
|
||||||
</DropdownMenuItem>
|
<DropdownMenuItem className='pointer-events-none flex cursor-default gap-2'>
|
||||||
|
<UserIcon />
|
||||||
|
{account.username}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuSeparator />
|
||||||
|
<DropdownMenuItem className='flex cursor-pointer items-center gap-2' onClick={logOut}>
|
||||||
|
<LogOut />
|
||||||
|
Log out
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<DropdownMenuItem
|
||||||
|
className='flex cursor-pointer items-center gap-2'
|
||||||
|
disabled={auth.isPending}
|
||||||
|
onClick={() => auth.mutate()}
|
||||||
|
>
|
||||||
|
<LogIn />
|
||||||
|
Log in
|
||||||
|
</DropdownMenuItem>
|
||||||
|
)}
|
||||||
</DropdownMenuGroup>
|
</DropdownMenuGroup>
|
||||||
{/* <DropdownMenuLabel>My Account</DropdownMenuLabel>
|
|
||||||
<DropdownMenuSeparator /> */}
|
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,35 +1,38 @@
|
|||||||
import { useEffect, useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
|
|
||||||
import { createRequestToken } from '@/api';
|
import { createRequestToken, createSession } from '@/api';
|
||||||
|
import { useSetSession } from '@/hooks/useSession';
|
||||||
|
|
||||||
const useAuth = () => {
|
const useAuth = () => {
|
||||||
|
const setSession = useSetSession();
|
||||||
const tabRef = useRef<Window | null>(null);
|
const tabRef = useRef<Window | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
const session = useMutation({
|
||||||
const approveSource = new EventSource('/api/auth');
|
retry: 5,
|
||||||
|
mutationFn: createSession,
|
||||||
approveSource.onmessage = (event) => {
|
onSuccess({ session_id }) {
|
||||||
console.log(event.data);
|
setSession(session_id);
|
||||||
tabRef.current?.close();
|
tabRef.current?.close();
|
||||||
approveSource.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
approveSource.close();
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return useMutation({
|
|
||||||
mutationFn: createRequestToken,
|
|
||||||
onSuccess(requestToken) {
|
|
||||||
const link = `https://www.themoviedb.org/authenticate/${requestToken}?redirect_to=${encodeURIComponent(
|
|
||||||
`${location.origin}/api/approved`
|
|
||||||
)}`;
|
|
||||||
|
|
||||||
tabRef.current = window.open(link, '_blank');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const requestToken = useMutation({
|
||||||
|
mutationFn: createRequestToken,
|
||||||
|
onMutate() {
|
||||||
|
tabRef.current = window.open('', '_blank');
|
||||||
|
tabRef.current?.focus();
|
||||||
|
},
|
||||||
|
onSuccess({ redirectUrl, requestToken }) {
|
||||||
|
if (!tabRef.current) return;
|
||||||
|
|
||||||
|
tabRef.current.location = redirectUrl;
|
||||||
|
|
||||||
|
session.mutate({ requestToken });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return requestToken;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useAuth;
|
export default useAuth;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
|
import { useSetSession } from '@/hooks/useSession';
|
||||||
|
|
||||||
|
const useLogOut = () => {
|
||||||
|
const setSession = useSetSession();
|
||||||
|
|
||||||
|
return useCallback(() => setSession(null), [setSession]);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useLogOut;
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { account } from '@/api';
|
||||||
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||||
|
import { useSession } from './useSession';
|
||||||
|
|
||||||
|
const KEY = ['account'];
|
||||||
|
|
||||||
|
const useAccount = () => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const session = useSession();
|
||||||
|
|
||||||
|
const query = useQuery({
|
||||||
|
enabled: Boolean(session),
|
||||||
|
staleTime: Infinity,
|
||||||
|
notifyOnChangeProps: ['data'],
|
||||||
|
queryKey: KEY,
|
||||||
|
queryFn: () => account()
|
||||||
|
});
|
||||||
|
|
||||||
|
if (session === null) {
|
||||||
|
queryClient.removeQueries({ queryKey: KEY });
|
||||||
|
queryClient.resetQueries({ queryKey: KEY });
|
||||||
|
}
|
||||||
|
|
||||||
|
return session ? query.data : undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useAccount;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { usersShows } from '@/api';
|
||||||
|
import useInfiniteList from './useInfiniteList';
|
||||||
|
import { useSession } from './useSession';
|
||||||
|
|
||||||
|
const useFavorites = ({
|
||||||
|
showType,
|
||||||
|
listType = 'favorites'
|
||||||
|
}: {
|
||||||
|
showType: Show['type'];
|
||||||
|
listType: 'favorites' | 'watchlist';
|
||||||
|
}) => {
|
||||||
|
const session = useSession();
|
||||||
|
|
||||||
|
return useInfiniteList({
|
||||||
|
queryKey: [`users-${listType}`, showType],
|
||||||
|
queryFn: () => usersShows({ showType, listType }),
|
||||||
|
enabled: Boolean(session)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useFavorites;
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { atom, useAtomValue, useSetAtom } from 'jotai';
|
||||||
|
import Cookies from 'js-cookie';
|
||||||
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
|
const sessionAtom = atom<string | null>(Cookies.get('session') as string);
|
||||||
|
|
||||||
|
export const useSession = () => useAtomValue(sessionAtom);
|
||||||
|
|
||||||
|
export const useSetSession = () => {
|
||||||
|
const setSession = useSetAtom(sessionAtom);
|
||||||
|
|
||||||
|
return useCallback(
|
||||||
|
(session: string | null) => {
|
||||||
|
typeof session === 'string' ? Cookies.set('session', session) : Cookies.remove('session');
|
||||||
|
setSession(session);
|
||||||
|
},
|
||||||
|
[setSession]
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import { EventEmitter } from 'events';
|
|
||||||
|
|
||||||
class RequestTokenBroadcaster extends EventEmitter {}
|
|
||||||
const requestTokenBroadcaster = new RequestTokenBroadcaster();
|
|
||||||
|
|
||||||
export default requestTokenBroadcaster;
|
|
||||||
+23
-11
@@ -1,17 +1,29 @@
|
|||||||
import { cache } from 'react';
|
import { defaultShouldDehydrateQuery, isServer, QueryClient } from '@tanstack/react-query';
|
||||||
import { QueryClient, QueryClientConfig } from '@tanstack/react-query';
|
|
||||||
|
|
||||||
export const queryClientOptions: QueryClientConfig = {
|
const makeQueryClient = () => {
|
||||||
defaultOptions: {
|
return new QueryClient({
|
||||||
queries: {
|
defaultOptions: {
|
||||||
refetchOnWindowFocus: false,
|
queries: {
|
||||||
staleTime: Infinity,
|
refetchOnWindowFocus: false,
|
||||||
refetchOnReconnect: false,
|
staleTime: Infinity,
|
||||||
refetchOnMount: false
|
refetchOnReconnect: false,
|
||||||
|
refetchOnMount: false
|
||||||
|
},
|
||||||
|
dehydrate: {
|
||||||
|
shouldDehydrateQuery: (query) => defaultShouldDehydrateQuery(query) || query.state.status === 'pending'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getQueryClient = cache(() => new QueryClient(queryClientOptions));
|
let browserQueryClient: QueryClient | undefined = undefined;
|
||||||
|
|
||||||
|
const getQueryClient = () => {
|
||||||
|
if (isServer) return makeQueryClient();
|
||||||
|
|
||||||
|
if (!browserQueryClient) browserQueryClient = makeQueryClient();
|
||||||
|
|
||||||
|
return browserQueryClient;
|
||||||
|
};
|
||||||
|
|
||||||
export default getQueryClient;
|
export default getQueryClient;
|
||||||
Generated
+18
-16
@@ -16,7 +16,7 @@
|
|||||||
"@radix-ui/react-tabs": "^1.0.4",
|
"@radix-ui/react-tabs": "^1.0.4",
|
||||||
"@radix-ui/react-toast": "^1.2.2",
|
"@radix-ui/react-toast": "^1.2.2",
|
||||||
"@radix-ui/react-toggle": "^1.0.3",
|
"@radix-ui/react-toggle": "^1.0.3",
|
||||||
"@tanstack/react-query": "^5.17.3",
|
"@tanstack/react-query": "^5.59.15",
|
||||||
"@vidstack/react": "^1.12.11",
|
"@vidstack/react": "^1.12.11",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
@@ -2539,27 +2539,29 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tanstack/query-core": {
|
"node_modules/@tanstack/query-core": {
|
||||||
"version": "5.28.4",
|
"version": "5.59.13",
|
||||||
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.28.4.tgz",
|
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.59.13.tgz",
|
||||||
"integrity": "sha512-uQZqOFqLWUvXNIQZ63XdKzg22NtHzgCBUfDmjDHi3BoF+nUYeBNvMi/xFPtFrMhqRzG2Ir4mYaGsWZzmiEjXpA==",
|
"integrity": "sha512-Oou0bBu/P8+oYjXsJQ11j+gcpLAMpqW42UlokQYEz4dE7+hOtVO9rVuolJKgEccqzvyFzqX4/zZWY+R/v1wVsQ==",
|
||||||
|
"license": "MIT",
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/tannerlinsley"
|
"url": "https://github.com/sponsors/tannerlinsley"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tanstack/react-query": {
|
"node_modules/@tanstack/react-query": {
|
||||||
"version": "5.28.4",
|
"version": "5.59.15",
|
||||||
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.28.4.tgz",
|
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.59.15.tgz",
|
||||||
"integrity": "sha512-BErcoB/QQG6YwLSUKnaGxF+lSc270RH2w3kMBpG0i4YzDCsFs2pdxPX1WVknQvFk9bNgukMb158hc2Zb4SdwSA==",
|
"integrity": "sha512-QbVlAkTI78wB4Mqgf2RDmgC0AOiJqer2c5k9STOOSXGv1S6ZkY37r/6UpE8DbQ2Du0ohsdoXgFNEyv+4eDoPEw==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tanstack/query-core": "5.28.4"
|
"@tanstack/query-core": "5.59.13"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/tannerlinsley"
|
"url": "https://github.com/sponsors/tannerlinsley"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^18.0.0"
|
"react": "^18 || ^19"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/js-cookie": {
|
"node_modules/@types/js-cookie": {
|
||||||
@@ -8946,16 +8948,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@tanstack/query-core": {
|
"@tanstack/query-core": {
|
||||||
"version": "5.28.4",
|
"version": "5.59.13",
|
||||||
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.28.4.tgz",
|
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.59.13.tgz",
|
||||||
"integrity": "sha512-uQZqOFqLWUvXNIQZ63XdKzg22NtHzgCBUfDmjDHi3BoF+nUYeBNvMi/xFPtFrMhqRzG2Ir4mYaGsWZzmiEjXpA=="
|
"integrity": "sha512-Oou0bBu/P8+oYjXsJQ11j+gcpLAMpqW42UlokQYEz4dE7+hOtVO9rVuolJKgEccqzvyFzqX4/zZWY+R/v1wVsQ=="
|
||||||
},
|
},
|
||||||
"@tanstack/react-query": {
|
"@tanstack/react-query": {
|
||||||
"version": "5.28.4",
|
"version": "5.59.15",
|
||||||
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.28.4.tgz",
|
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.59.15.tgz",
|
||||||
"integrity": "sha512-BErcoB/QQG6YwLSUKnaGxF+lSc270RH2w3kMBpG0i4YzDCsFs2pdxPX1WVknQvFk9bNgukMb158hc2Zb4SdwSA==",
|
"integrity": "sha512-QbVlAkTI78wB4Mqgf2RDmgC0AOiJqer2c5k9STOOSXGv1S6ZkY37r/6UpE8DbQ2Du0ohsdoXgFNEyv+4eDoPEw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@tanstack/query-core": "5.28.4"
|
"@tanstack/query-core": "5.59.13"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/js-cookie": {
|
"@types/js-cookie": {
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "npm run lint && next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint --fix .",
|
"lint": "next lint --fix .",
|
||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"@radix-ui/react-tabs": "^1.0.4",
|
"@radix-ui/react-tabs": "^1.0.4",
|
||||||
"@radix-ui/react-toast": "^1.2.2",
|
"@radix-ui/react-toast": "^1.2.2",
|
||||||
"@radix-ui/react-toggle": "^1.0.3",
|
"@radix-ui/react-toggle": "^1.0.3",
|
||||||
"@tanstack/react-query": "^5.17.3",
|
"@tanstack/react-query": "^5.59.15",
|
||||||
"@vidstack/react": "^1.12.11",
|
"@vidstack/react": "^1.12.11",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
|
|||||||
+4
-4
@@ -1,11 +1,11 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { FC, ReactNode, useState } from 'react';
|
import { FC, ReactNode } from 'react';
|
||||||
import ModalContainer from 'react-modal-promise';
|
import ModalContainer from 'react-modal-promise';
|
||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
import { QueryClientProvider } from '@tanstack/react-query';
|
||||||
|
|
||||||
import { Toaster } from '@/components/ui/toaster';
|
import { Toaster } from '@/components/ui/toaster';
|
||||||
import { queryClientOptions } from '@/lib/queryClient';
|
import getQueryClient from '@/lib/queryClient';
|
||||||
|
|
||||||
import ThemeProvider from './Theme';
|
import ThemeProvider from './Theme';
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Providers: FC<Props> = ({ children, theme }) => {
|
const Providers: FC<Props> = ({ children, theme }) => {
|
||||||
const [queryClient] = useState(() => new QueryClient(queryClientOptions));
|
const queryClient = getQueryClient();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
|
|||||||
Vendored
+19
@@ -171,3 +171,22 @@ interface RequestToken {
|
|||||||
expires_at: string;
|
expires_at: string;
|
||||||
request_token: string;
|
request_token: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Session {
|
||||||
|
session_id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Account {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
username: string;
|
||||||
|
avatar: Avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Gravatar {
|
||||||
|
hash: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Tmdb {
|
||||||
|
avatar_path: null;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user