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, useState} from 'react'; | |
export const FormContext = createContext(); | |
export const FormContextProvider = ({children}) => { | |
const [step1Answered, setStep1Answered] = useState(false); | |
const [step2Answered, setStep2Answered] = useState(false); | |
const [step3Answered, setStep3Answered] = useState(false); | |
const [finished, setFinished] = useState(false); | |
const [stepData, setStepData] = useState({ | |
step1: { |
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 from 'react'; | |
import { FormContextProvider } from './FormContext'; | |
import Stepper from './Stepper'; | |
/** | |
* Form Context Store | |
*/ | |
function SelectStepper() { | |
return ( | |
<FormContextProvider> |
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 from 'react'; | |
import { | |
Controller | |
} from 'react-hook-form'; | |
import Box from '@mui/material/Box'; | |
import InputLabel from '@mui/material/InputLabel'; | |
import MenuItem from '@mui/material/MenuItem'; | |
import FormControl from '@mui/material/FormControl'; | |
import Select from '@mui/material/Select'; | |
import Typography from '@mui/material/Typography'; |
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
function Step2({ | |
FormContext | |
}) { | |
/** | |
* Context Store | |
*/ | |
const { | |
step2Answered, | |
setStep2Answered, |
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
{ | |
"name": "server", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "nodemon index --ignore db.json" | |
}, | |
"author": "", | |
"license": "ISC", |
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 express from "express"; | |
import cors from 'cors'; | |
import morgan from "morgan"; | |
import { Low, JSONFile } from 'lowdb'; | |
import userRouter from './users.js'; | |
import { nanoid } from 'nanoid'; | |
const adapter = new JSONFile("db.json"); | |
const db = new Low(adapter); | |
db.data = ({ users: [ |
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 express from 'express'; | |
import { nanoid } from 'nanoid'; | |
const idLength = 8; | |
const router = express.Router(); | |
/*** | |
* List all pusers | |
*/ | |
router.get("/", (req, res) => { |
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
/* eslint-disabled */ | |
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit"; | |
export const getSettings = store => { | |
return store.getState(); | |
}; | |
export const signupUser = createAsyncThunk( | |
'user/signup', | |
async ({ email, password }, thunkAPI) => { | |
try { |
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 { combineReducers } from "redux"; | |
import { configureStore } from "@reduxjs/toolkit"; | |
import UserSlice from './UserSlice'; | |
const rootReducer = combineReducers({ | |
user: UserSlice | |
}); | |
export const store = configureStore({ | |
reducer: rootReducer, |
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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { Provider} from 'react-redux'; | |
import { store } from './Store/'; | |
import App from './App'; | |
import reportWebVitals from './reportWebVitals'; | |
ReactDOM.render( | |
<React.StrictMode> | |
<Provider store={store}> |
OlderNewer