๐
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 from "next-auth"; | |
| import CredentialsProvider from "next-auth/providers/credentials"; | |
| type TA_Token = { | |
| token: string; | |
| user_id: number; | |
| }; | |
| export default NextAuth({ | |
| providers: [ |
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 { useMemo } from 'react'; | |
| type Connection<T> = { | |
| readonly edges : readonly ({ | |
| readonly node? : T | null ; | |
| readonly cursor?:string | |
| } | null)[]; | |
| }; | |
| export function useConnection<T>(connection?:Connection<T>){ |
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 { ActionType } from '../actionTypes' | |
| import { Action } from '../actions' | |
| interface RepositoriesState { | |
| loading: boolean | |
| error: string | null | |
| data: string[] | |
| } | |
| const initialState = { |
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 ok = 45 |
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 signUpHandler: RequestHandler<{}, {}, SignUpBody> = async ( | |
| req, | |
| res | |
| ) => { | |
| const { firstName, lastName, email, password } = req.body | |
| const isAlreadyRegistered = await User.findOne({ | |
| email, | |
| }) | |
| if (isAlreadyRegistered) { |
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 { NextFunction, Request, Response } from 'express' | |
| import { BaseSchema } from 'yup' | |
| import { MixedSchema } from 'yup/lib/mixed' | |
| /** | |
| * This middleware checks the req.body against an yup schema provided in it | |
| * @example | |
| * ``` | |
| * validate(incomingRequestBody, incomingBodySchema) | |
| * |
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' | |
| import log from '../utils/logger' | |
| /** | |
| * @description - This function creates connection to the database with given options. | |
| * Resolves to connection with DB or Failure with an error message | |
| * */ | |
| export const makeConnection = async () => { | |
| await mongoose | |
| .connect( |
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 clsx from 'clsx' | |
| import React, { useCallback, useEffect } from 'react' | |
| import { useDropzone } from 'react-dropzone' | |
| import { useFormContext } from 'react-hook-form' | |
| import { HiOutlinePhotograph } from 'react-icons/hi' | |
| import { Alert } from '../Alert' | |
| interface FileInputProps | |
| extends React.DetailedHTMLProps< | |
| React.InputHTMLAttributes<HTMLInputElement>, |
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 { createContext, useContext, useEffect, useState } from 'react' | |
| import { getUser, logout } from 'services/axios' | |
| /** | |
| * getUser() -> Helper function to fetch user information. (basically an axios call) | |
| * logout() -> Helper function to logout users | |
| */ | |
| const AuthContext = createContext() |
NewerOlder