Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback Slice, Feedback Quote bubble component, and Perf related #179

Merged
merged 26 commits into from
May 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2964d74
feat: add APPLY_FOR_COURSE label to constant/label.ts
ballyalley-o May 7, 2024
9b5e5ec
refactor: Add collapse table component to CourseRow for better code o…
ballyalley-o May 7, 2024
a67ed84
refactor: Add CollapseGrid component to Bootcamp section for better c…
ballyalley-o May 7, 2024
110d24d
🐞 fix(refactor: Adjust position of GSBadgeImg in main.ts):
ballyalley-o May 7, 2024
6e09074
refactor: Update background styling in AppForm component
ballyalley-o May 7, 2024
1a71bef
refactor: Remove commented out code in main.tsx
ballyalley-o May 7, 2024
e9b3285
[BUG] Failed Auth in Login page throws an exemption #167
ballyalley-o May 7, 2024
e40ba2f
[BUG] Failed Auth in Login page throws an exemption #167: refactor: H…
ballyalley-o May 7, 2024
9b9ff01
[Client] TCCPISSUE: Refactor Navbar Drawer #141: [Clean-up] refactor:…
ballyalley-o May 11, 2024
8d1b134
Redux | Feedback Slice #17: Add FEEDBACK route to routing constants
ballyalley-o May 11, 2024
6d9f048
Add FEEDBACKS and TAGS labels to constant/label.ts
ballyalley-o May 11, 2024
4d3771a
update placeholder.ts
ballyalley-o May 11, 2024
23f6901
refactor: Adjust padding in main.tsx
ballyalley-o May 11, 2024
986b66f
Optimized Bootcamp page with lazy loading for images
ballyalley-o May 11, 2024
9b2d1d1
feat: Add BOOTCAMP_FEEDBACK route to ServerPath class
ballyalley-o May 11, 2024
070691e
[Client] Feat: Feedback Quote buble #171: Add FeedbackBubble compone…
ballyalley-o May 11, 2024
119ad12
[Client] Feat: Feedback Quote buble #171: Add FeedbackBubble compone…
ballyalley-o May 11, 2024
f47ceb6
chore: Remove unused Bootcamp component and export statement
ballyalley-o May 11, 2024
2197a5a
feat: Add QuoteBubble component for displaying feedback quotes
ballyalley-o May 11, 2024
f391ed6
Slices-reducer: Bootcamp - Feedback
ballyalley-o May 11, 2024
06d2a84
Redux | Feedback Slice #17: Add feedback endpoint and slice for API i…
ballyalley-o May 11, 2024
87eee18
🎈 perf(Redux | Feedback Slice #17: Add feedbackReducer to root-reduce…
ballyalley-o May 11, 2024
94aeda0
chore: Update main.ts to include flex display and transparent backgro…
ballyalley-o May 11, 2024
6fada9b
refactor: Update palette.ts to fix primary and background colors
ballyalley-o May 11, 2024
4463a33
🐳 chore(chore: Update npm dependencies):
ballyalley-o May 11, 2024
1dd5ba3
Merge pull request #178 from ballyalley-o/feat/TCCP17-redux--feedback…
ballyalley-o May 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Slices-reducer: Bootcamp - Feedback
  • Loading branch information
ballyalley-o committed May 11, 2024
commit f391ed6cf3399ddcb01330b3257d8d4cb59f5bee
38 changes: 37 additions & 1 deletion src/store/slice/bootcamp/bootcamp.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
// import goodlog from 'good-logs'
import { createSlice } from '@reduxjs/toolkit'
import axiosInstance from 'util/axios'
import { ServerPath } from 'route/path'
import { GLOBAL } from 'config'

const initialState = {
initial: false,
responseMessage: null,
isLoading: false,
success: false,
bootcampFeedback: [],
error: null,
currentPage: 1,
user: null,
allBootcamp: [],
bootcamp: {},
@@ -21,6 +27,9 @@ const bootcampSlice = createSlice({
const { initial, isAuthenticated } = action.payload
state.initial = initial
},
setCurrentPage(state, action) {
state.currentPage = action.payload
},
setBootcamps(state, action) {
state.allBootcamp = action.payload
},
@@ -31,6 +40,11 @@ const bootcampSlice = createSlice({
state.responseMessage = action.payload.message
state.bootcamp = action.payload
},
getBootcampFeedback(state, action) {
state.isLoading = false
state.success = true
state.bootcampFeedback = action.payload
},
setCourses(state, action) {
state.allCourse = action.payload
},
@@ -66,6 +80,11 @@ const bootcampSlice = createSlice({
state.success = false
state.isLoading = false
},
resetBootcampFeedback(state) {
state.bootcampFeedback = []
state.success = false
state.isLoading = false
},
clearError(state, action) {
state.isLoading = false
state.error = null
@@ -77,15 +96,32 @@ export default bootcampSlice.reducer

export const {
setInitial,
setCurrentPage,
setBootcamps,
setBootcamp,
setCourses,
setCourse,
setLoading,
stopLoading,
hasError,
getBootcampFeedback,
setResetBootcamp,
setResetAllBootcamp,
setResetAllCourse,
clearError
clearError,
resetBootcampFeedback
} = bootcampSlice.actions

export function getBootcampFeedbackThunk(bootcampId: any) {
return async (dispatch: any) => {
dispatch(bootcampSlice.actions.setLoading({}))
try {
const response = await axiosInstance.get(GLOBAL.APP_SERVER + `/bootcamp/${bootcampId}/feedback`)

dispatch(getBootcampFeedback(response?.data))
} catch (error) {
dispatch(hasError(error))
console.error('bgRed', error)
}
}
}
16 changes: 14 additions & 2 deletions src/store/slice/bootcamp/endpoint.ts
Original file line number Diff line number Diff line change
@@ -19,6 +19,12 @@ export const bootcampSlice = apiSlice.injectEndpoints({
method: GET
})
}),
getBootcampFeedback: builder.query({
query: (id) => ({
url: ServerPath.BOOTCAMP_FEEDBACK(id),
method: GET
})
}),
createBootcamp: builder.mutation({
query: (data: any) => ({
url: ServerPath.BOOTCAMP,
@@ -44,5 +50,11 @@ export const bootcampSlice = apiSlice.injectEndpoints({
})
})

export const { useGetAllBootcampQuery, useGetBootcampQuery, useCreateBootcampMutation, useUpdateBootcampMutation, useDeleteBootcampMutation } =
bootcampSlice
export const {
useGetAllBootcampQuery,
useGetBootcampFeedbackQuery,
useGetBootcampQuery,
useCreateBootcampMutation,
useUpdateBootcampMutation,
useDeleteBootcampMutation
} = bootcampSlice
2 changes: 1 addition & 1 deletion src/store/slice/bootcamp/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './bootcamp'
export { default as bootcampReducer } from './bootcamp'
export * from './endpoint'