Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Sep 21, 2021

Handle mock API

What are you adding?

  • Implement Clients screen as template screen
  • Implement mock API
  • Modify axios intercepter to convert API response to camelCase format

Breaking changes?

Related PR

@ghost ghost marked this pull request as ready for review September 21, 2021 08:48
@yukinoda yukinoda self-requested a review September 22, 2021 07:23
@yukinoda
Copy link
Contributor

@mvn-binhnguyen-hn cc: @jacksonjp
Good feature, let's discuss if we want this in the template or not at the meeting :)

@yukinoda
Copy link
Contributor

@mvn-binhnguyen-hn
brought this about the mock adapter a little bit to this discussion
#107 (comment)

@yukinoda
Copy link
Contributor

@jacksonjp @geekonthemove cc: @mvn-binhnguyen-hn
I guess we can move the mock api related part to separate folder where the user can just remove it if is not going to be used?

@mvn-binhnguyen-hn
if adding the mock api, I think we need some documentation to let the user know that is an optional feature that can be removed by just deleting the folder.

Copy link

@jacksonjp jacksonjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! As Discussed in the meeting, lets maybe move some of the things around.

const authInterceptor = async (request: AxiosRequestConfig) => {
request.params = toSnakeCase(request.params, true);
request.data = toSnakeCase(request.data, true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets leave this to the project, this totally depends on the backend implementation and debugging to find this can be difficult

* @param {AxiosResponse} response
*/
const responseInterceptor = (response: AxiosResponse) => {
response.data = toCamel(response.data);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, it can vary from projects

@@ -0,0 +1,7 @@
import MockAdapter from "axios-mock-adapter";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, lets have it in the readme, instead of adding a package that we might not use.

@@ -0,0 +1,15 @@
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets move it to clients folder, so its easy to cleanup

@ghost
Copy link
Author

ghost commented Sep 28, 2021

@jacksonjp

- Implement mock API
- Modify axios intercepter to convert API response to camelCase format

Both above implementations seem not necessary for the admin panel template, it depends on which project the template will be used, so should we ignore and close this PR?

@jacksonjp
Copy link

@mvn-binhnguyen-hn Yea i think lets close this PR

@ghost ghost closed this Sep 28, 2021
@ghost
Copy link
Author

ghost commented Sep 28, 2021

@mvn-binhnguyen-hn Yea i think lets close this PR

@jacksonjp Okay, I closed this PR. thanks 👍

@jacksonjp jacksonjp deleted the feature/handle-mock-api branch October 6, 2021 07:30
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants