π
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 mongoose from "mongoose"; | |
let isConnected = false; | |
export const connectToDB = async () => { | |
mongoose.set("strictQuery", true); | |
if (isConnected) { | |
console.info("==== MongoDB is already connected ===="); | |
return; |
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 { NextRequest, NextResponse } from "next/server"; | |
import { getToken } from "next-auth/jwt"; | |
const PROTECTED_API_ROUTES = ["/api/todo"]; | |
const PROTECTED_ROUTES = ["/dashboard"]; | |
export async function middleware(request: NextRequest) { | |
const isProtectedApiRoute = PROTECTED_API_ROUTES.some((route: string) => request.nextUrl?.pathname?.startsWith(route)); | |
const isProtectedRoute = PROTECTED_ROUTES.some((route: string) => request.nextUrl?.pathname?.startsWith(route)); |
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
const handler = NextAuth({ | |
providers: [ | |
GoogleProvider({ | |
clientId: process.env.GOOGLE_ID ?? "", | |
clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? "", | |
}), | |
GithubProvider({ | |
clientId: process.env.GITHUB_ID ?? "", | |
clientSecret: process.env.GITHUB_CLIENT_SECRET ?? "", | |
}), |
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
Show hidden characters
"compilerOptions": { | |
... | |
"baseUrl": "./", | |
"paths": { | |
"@styles/*": ["src/styles/*"], | |
"@components/*": ["src/components/*"], | |
"@constants/*": ["src/constants/*"], | |
"@utils/*": ["src/utils/*"], | |
"@models/*": ["src/models/*"], | |
"@services/*": ["src/services/*"], |
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 CustomAvatar from "../../../../atoms/CustomAvatar"; // β | |
import CustomAvatar from "@components/atoms/CustomAvatar"; // β |
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 { ConfigProvider } from "antd"; | |
import Colors from "@styles/variables.module.sass"; | |
const AntdConfigProvider = ({ children }: Props) => { | |
const THEME = { | |
token: { | |
colorPrimary: Colors.primaryColor, | |
}, | |
} |
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
// ------ Colors ------ | |
$primary-color: #292929 | |
$primary-surface-color: #F9F9F9 | |
$success-color: #52c41a | |
$warning-color: #faad14 | |
$error-color: #ff4d4f | |
$secondary-surface-color: #FFF | |
$font-color-light: #FFF |
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
/** | |
* | |
* Define all global types in this file. | |
* | |
*/ | |
type User = { | |
email: string; | |
image: string; | |
username: string; |