swsnu / swpp2020-team13

Goaling Ball: Your goal management service.
0 stars 3 forks source link

Frontend Redux Store and Reducers Design #6

Closed ChanwooLucioLee closed 3 years ago

ChanwooLucioLee commented 3 years ago

We need to design how redux store and reducers should look like.

Are we going to make a reducer per model in the backend? ex) goalReducer, taskReducer, achievementReducer

Also, how are we going to keep user's session information in the frontend? Some reducer should be responsible for it and we will need to design how it looks like.

jiyewise commented 3 years ago

I prefer making reducers per model, is there a better idea? There could be a loginUser reducer to fetch information about the currently-logged in user, but I don't really get the meaning of 'user's session information' in your comment, so I'm not sure whether my comment is sufficient or not. :(

ChanwooLucioLee commented 3 years ago

@jiyewise If we don't keep user's session information (i.e., a fact that the user has logged in a few minutes ago), we will need to include the user's id and password every time the frontend makes POST/PUT/DELETE requests to the backend.

jiyewise commented 3 years ago

@ChanwooLucioLee Oh, in that case, I think making a loginUser reducer could be fine. In HW3, I have implemented loginUser reducer and saved logged-user info in reducer store to decide whether the edit or delete button should be rendered. Or, I remember in HW4 there was a instruction that the user info is naturally included in the request, isn't it part of django feature? After HW4 I thought the request after login would naturally include user info..

ChanwooLucioLee commented 3 years ago

@jiyewise I think you're right. We might not need to do anything in frontend for maintaining sessions.