Skip to content

Instantly share code, notes, and snippets.

View StackTrac3's full-sized avatar
๐Ÿ“ˆ

Justin StackTrac3

๐Ÿ“ˆ
View GitHub Profile
import React, { useState, useEffect, createContext, useContext, ReactNode } from 'react'
import Amplify, { Auth, Hub } from 'aws-amplify'
import { CognitoUser } from '@aws-amplify/auth'
import { CognitoUserSession } from 'amazon-cognito-identity-js'
import { HubCallback } from '@aws-amplify/core/lib/Hub'
import IUser from '../../types/IUser'
interface IAuthContext {
user: IUser | null
login(username: string, password: string): Promise<CognitoUser>