From 9d2a0678be616ffba31149b6ed8e8244d0061c49 Mon Sep 17 00:00:00 2001 From: KS Jannette Date: Sun, 29 Mar 2026 07:02:20 -0400 Subject: [PATCH] more --- frontend/src/reducers/authReducer.jsx | 44 ++++++++++++--------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/frontend/src/reducers/authReducer.jsx b/frontend/src/reducers/authReducer.jsx index f29f16f..dd1c505 100644 --- a/frontend/src/reducers/authReducer.jsx +++ b/frontend/src/reducers/authReducer.jsx @@ -1,38 +1,32 @@ import { useReducer } from "react" +const UserAuthContext = createContext(); + export const initialState = { - user: null, - tier: null, + authUser: null, + AuthTier: null }; -const shopReducer = (state, action) => { - const { name, payload } = action; +const authReducer = (state, action) => { + const { type, payload = "FREE_TIER" } = action switch (type) { - case "ADD_TO_CART": - console.log("ADD_TO_CART", payload); - + case "ADD_AUTH_USER": + console.log("ADD_AUTH_USER", payload); return { ...state, - products: payload.products - }; - case "REMOVE_FROM_CART": - console.log("REMOVE_FROM_CART", payload); - - return { - ...state, - products: payload.products - }; - case "UPDATE_PRICE": - console.log("UPDATE_PRICE", payload); - - return { - ...state, - total: payload.total + auth: payload }; default: - throw new Error(`No case for type ${type} found in shopReducer.`); + throw new Error(`No case for type ${type} found.`); } -}; + switch (type) { + case "DELETE_AUTH_USER": + return { + ...state, + users: state.users.filter(user => user.id !== action.userIdToDelete) + }; + } +} -export default shopReducer; \ No newline at end of file +export default shopReducer \ No newline at end of file