-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1 feat: [ Setup] Setup code React + Vite
- Loading branch information
Showing
8 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
# APP | ||
NODE_ENV='dev' | ||
|
||
# FIREBASE | ||
API_KEY='AIzaSyB8pGeybQakGG65sNuXDNXXPhSUJj431Tg' | ||
AUTH_DOMAIN='class-react-d5c6b.firebaseapp.com' | ||
DATABASE_URL='' | ||
PROJECT_ID='class-react-d5c6b' | ||
STORAGE_BUCKET='class-react-d5c6b.appspot.com' | ||
MESSAGE_SENDER_ID='870565752408' | ||
APP_ID='1:870565752408:web:a1a365631866f80094a42d' | ||
APP_ID='1:870565752408:web:a1a365631866f80094a42d' | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const NODE_APP = { | ||
DEV: "dev", | ||
PRO: "pro", | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
//* LIB | ||
import ReactDOM from "react-dom/client"; | ||
import { Provider } from "react-redux"; | ||
import { BrowserRouter as Router } from "react-router-dom"; | ||
|
||
//* IMPORT | ||
import App from "./App.jsx"; | ||
import store from "./redux/store.jsx"; | ||
|
||
ReactDOM.createRoot(document.getElementById("root")).render( | ||
<Router> | ||
<App /> | ||
</Router> | ||
<Provider store={store}> | ||
<Router> | ||
<App /> | ||
</Router> | ||
</Provider> | ||
); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//* LIB | ||
import { createSlice } from "@reduxjs/toolkit"; | ||
|
||
const initialState = { | ||
authData: null, | ||
isLoading: false, | ||
error: null, | ||
}; | ||
|
||
const AuthSlice = createSlice({ | ||
name: "auth", | ||
initialState, | ||
reducers: { | ||
resetDataAuth: (state) => { | ||
return state; | ||
}, | ||
}, | ||
extraReducers: {}, | ||
}); | ||
const AuthReducer = AuthSlice.reducer; | ||
// eslint-disable-next-line react-refresh/only-export-components | ||
export const { resetDataAuth } = AuthSlice.actions; | ||
|
||
export default AuthReducer; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//* LIB | ||
import { combineReducers, configureStore } from "@reduxjs/toolkit"; | ||
import logger from "redux-logger"; | ||
import thunk from "redux-thunk"; | ||
|
||
//* IMPORT | ||
import AuthReducer from "./auth/authSlice"; | ||
import { NODE_APP } from "@/common/constants"; | ||
|
||
const middleware = [thunk]; | ||
|
||
const checkLogDev = process.env.NODE_ENV === NODE_APP.DEV; | ||
if (checkLogDev) { | ||
middleware.push(logger); | ||
} | ||
|
||
const reducer = combineReducers({ | ||
auth: AuthReducer, | ||
}); | ||
|
||
const store = configureStore({ | ||
reducer: reducer, | ||
}); | ||
export default store; |