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 useAuth from "../hooks/useAuth"; | |
import { useEffect } from "react"; | |
import LoadingSpinner from "../components/LoadingSpinner"; | |
export default function SignIn() { | |
const navigate = useNavigate(); | |
const { signIn, isAuthenticated, isAuthenticating } = useAuth(); | |
. |
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 LoadingSpinner from "./LoadingSpinner"; | |
import useAuth from "../hooks/useAuth"; | |
. | |
. | |
const DashboardLayout = () => { | |
const navigate = useNavigate(); | |
const [open, setOpen] = React.useState(true); | |
const { isAuthenticating, isAuthenticated, signOut } = useAuth(); |
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 { useNavigate } from "react-router-dom"; | |
import useAuth from "../hooks/useAuth"; | |
import { useEffect } from "react"; | |
import LoadingSpinner from "../components/LoadingSpinner"; | |
export default function SignUp() { | |
. | |
. |
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 * as React from "react"; | |
import { createRoot } from "react-dom/client"; | |
import CssBaseline from "@mui/material/CssBaseline"; | |
import { ThemeProvider } from "@mui/material/styles"; | |
import App from "./App"; | |
import theme from "./theme"; | |
// import aws amplify | |
import { Amplify } from "aws-amplify"; | |
import awsExports from "./aws-exports"; | |
import AuthProvider from "./contexts/AuthContext"; |
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 aws amplify | |
import { Amplify } from "aws-amplify"; | |
import awsExports from "./aws-exports"; | |
// configure amplify | |
Amplify.configure(awsExports); |
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 {useContext} from "react"; | |
import {AuthContext, IAuthContextType} from "../contexts/AuthContext"; | |
const useAuth = () => useContext(AuthContext) as IAuthContextType; | |
export default useAuth; |
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 React, { useEffect, useState } from "react"; | |
import { Auth, Hub } from "aws-amplify"; | |
import LoadingSpinner from "../components/LoadingSpinner"; | |
export interface IAuthContextType { | |
user: any; | |
isAuthenticated: boolean; | |
isAuthenticating: boolean; | |
unverifiedAccount: { email: string; password: string }; | |
signIn: (p: { email: string; password: string }) => Promise<any>; |
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 searchDefinitions = async () => { | |
... | |
recordWordInAnalytics(searchInput); // call the function to record search event | |
const response = await fetch( | |
`https://api.dictionaryapi.dev/api/v2/entries/en/${searchInput}`, | |
{ | |
method: "GET", |
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 analytics | |
import { Analytics } from "aws-amplify"; | |
// record searched word in Analytics | |
const recordWordInAnalytics = (searchWord: string) => { | |
if (searchWord !== "") { | |
const lowerCaseWord = searchWord?.toLowerCase(); | |
console.log("recordWordInAnalytics: ", lowerCaseWord); | |
try { | |
Analytics.record({ |
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 { Auth, Amplify } from "aws-amplify"; | |
//configure amplify | |
import awsconfig from './aws-exports'; | |
Auth.configure(awsconfig); | |
Amplify.configure(awsconfig); |
NewerOlder