├── .eslintrc.json ├── .gitignore ├── README.md ├── middleware.ts ├── next.config.js ├── package.json ├── pages ├── _app.tsx ├── about.tsx ├── api │ └── hello.ts ├── index.tsx ├── login.tsx └── profile.tsx ├── postcss.config.js ├── public ├── favicon.ico └── vercel.svg ├── src ├── components │ └── UploadAvatar.tsx ├── hooks │ └── auth │ │ ├── useCurrentUser.ts │ │ ├── useLogin.ts │ │ └── useLogout.ts ├── router │ └── routes.ts ├── services │ ├── auth.service.ts │ └── index.ts ├── types │ └── user.ts └── utils │ └── getAuthorizationHeader.ts ├── styles ├── Home.module.css └── globals.css ├── tailwind.config.js ├── tsconfig.json └── yarn.lock /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/.gitignore -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/README.md -------------------------------------------------------------------------------- /middleware.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/middleware.ts -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/next.config.js -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/package.json -------------------------------------------------------------------------------- /pages/_app.tsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/pages/_app.tsx -------------------------------------------------------------------------------- /pages/about.tsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/pages/about.tsx -------------------------------------------------------------------------------- /pages/api/hello.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/pages/api/hello.ts -------------------------------------------------------------------------------- /pages/index.tsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/pages/index.tsx -------------------------------------------------------------------------------- /pages/login.tsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/pages/login.tsx -------------------------------------------------------------------------------- /pages/profile.tsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/pages/profile.tsx -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/postcss.config.js -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/vercel.svg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/public/vercel.svg -------------------------------------------------------------------------------- /src/components/UploadAvatar.tsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/src/components/UploadAvatar.tsx -------------------------------------------------------------------------------- /src/hooks/auth/useCurrentUser.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/src/hooks/auth/useCurrentUser.ts -------------------------------------------------------------------------------- /src/hooks/auth/useLogin.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/src/hooks/auth/useLogin.ts -------------------------------------------------------------------------------- /src/hooks/auth/useLogout.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/src/hooks/auth/useLogout.ts -------------------------------------------------------------------------------- /src/router/routes.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/src/router/routes.ts -------------------------------------------------------------------------------- /src/services/auth.service.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/src/services/auth.service.ts -------------------------------------------------------------------------------- /src/services/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/src/services/index.ts -------------------------------------------------------------------------------- /src/types/user.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/src/types/user.ts -------------------------------------------------------------------------------- /src/utils/getAuthorizationHeader.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/src/utils/getAuthorizationHeader.ts -------------------------------------------------------------------------------- /styles/Home.module.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/styles/Home.module.css -------------------------------------------------------------------------------- /styles/globals.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/styles/globals.css -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/tailwind.config.js -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/tsconfig.json -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduc1901/nextjs-jwt-auth/HEAD/yarn.lock --------------------------------------------------------------------------------