From fdec33ae64307af0b35921c0b28d14c1988d0380 Mon Sep 17 00:00:00 2001 From: ner Date: Wed, 16 Oct 2024 22:44:14 +0300 Subject: [PATCH] feat: auth --- api/index.ts | 4 ++++ components/Header/components/User/index.tsx | 13 +++++++++++++ components/Header/index.tsx | 2 ++ package-lock.json | 17 +++++++++-------- package.json | 2 +- types.d.ts | 6 ++++++ 6 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 components/Header/components/User/index.tsx diff --git a/api/index.ts b/api/index.ts index 96bf482..a3008ef 100644 --- a/api/index.ts +++ b/api/index.ts @@ -8,6 +8,10 @@ import yts from './parsers/yts'; import http from './Http'; import { Sort } from './parsers'; +export const createRequestToken = async () => { + return http.get('/authentication/token/new').then(({ request_token }) => request_token); +}; + export const search = async ({ query, page, diff --git a/components/Header/components/User/index.tsx b/components/Header/components/User/index.tsx new file mode 100644 index 0000000..03d9b6e --- /dev/null +++ b/components/Header/components/User/index.tsx @@ -0,0 +1,13 @@ +import { UserRound } from 'lucide-react'; + +import { Button } from '@/components/ui/button'; + +const User = () => { + return ( + + ); +}; + +export default User; diff --git a/components/Header/index.tsx b/components/Header/index.tsx index 5298ca1..9ff865a 100644 --- a/components/Header/index.tsx +++ b/components/Header/index.tsx @@ -7,6 +7,7 @@ import { cn } from '@/lib/utils'; import { DesktopNavigation, MobileNavigation } from './components/Navigation'; import ToggleSearch from './components/Search'; import ToggleTheme from './components/ThemeToggle'; +import User from './components/User'; interface Props { className?: string; @@ -28,6 +29,7 @@ const Header: FC = ({ className }) => (
+
diff --git a/package-lock.json b/package-lock.json index 658ef46..a5b9460 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "eslint-config-next": "^14.2.7", "jotai": "^2.2.2", "js-cookie": "^3.0.5", - "lucide-react": "^0.263.0", + "lucide-react": "^0.453.0", "media-icons": "^1.1.5", "next": "^14.2.7", "node-html-parser": "^6.1.5", @@ -5137,11 +5137,12 @@ } }, "node_modules/lucide-react": { - "version": "0.263.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.263.0.tgz", - "integrity": "sha512-F+rHswbbI1xuDZ/OzofiJZJVlBPOIYVVST705cPdRLImJ5aOJNXYaFBPNo3qdUV0iEG/4nZeiUtLSHO2qU2ISw==", + "version": "0.453.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.453.0.tgz", + "integrity": "sha512-kL+RGZCcJi9BvJtzg2kshO192Ddy9hv3ij+cPrVPWSRzgCWCVazoQJxOjAwgK53NomL07HB7GPHW120FimjNhQ==", + "license": "ISC", "peerDependencies": { - "react": "^16.5.1 || ^17.0.0 || ^18.0.0" + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc" } }, "node_modules/media-captions": { @@ -10383,9 +10384,9 @@ } }, "lucide-react": { - "version": "0.263.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.263.0.tgz", - "integrity": "sha512-F+rHswbbI1xuDZ/OzofiJZJVlBPOIYVVST705cPdRLImJ5aOJNXYaFBPNo3qdUV0iEG/4nZeiUtLSHO2qU2ISw==", + "version": "0.453.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.453.0.tgz", + "integrity": "sha512-kL+RGZCcJi9BvJtzg2kshO192Ddy9hv3ij+cPrVPWSRzgCWCVazoQJxOjAwgK53NomL07HB7GPHW120FimjNhQ==", "requires": {} }, "media-captions": { diff --git a/package.json b/package.json index b564658..463fe19 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "eslint-config-next": "^14.2.7", "jotai": "^2.2.2", "js-cookie": "^3.0.5", - "lucide-react": "^0.263.0", + "lucide-react": "^0.453.0", "media-icons": "^1.1.5", "next": "^14.2.7", "node-html-parser": "^6.1.5", diff --git a/types.d.ts b/types.d.ts index c50e7ab..5228597 100644 --- a/types.d.ts +++ b/types.d.ts @@ -165,3 +165,9 @@ interface FileStat { path: string; length: number; } + +interface RequestToken { + success: boolean; + expires_at: string; + request_token: string; +}