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

middleware 개선 #62

Open
Su-Yong opened this issue May 17, 2022 · 0 comments
Open

middleware 개선 #62

Su-Yong opened this issue May 17, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Su-Yong
Copy link
Owner

Su-Yong commented May 17, 2022

  • middleware에서 가져온 값을 사용할 수 있도록 함
  • middleware async function 지원
const middleware = createMiddleware(async (state, send) => {
  const value = await getToken();
  send('token', value);

  return (after) => {
    // do somthing
  };
});

const fetcher = (url) => {
  const token = middleware.receive('token');
}

const data = useRequest(url, { fetcher });
@Su-Yong Su-Yong added the enhancement New feature or request label May 17, 2022
@Su-Yong Su-Yong self-assigned this May 17, 2022
@Su-Yong Su-Yong added this to the 0.6.0 milestone May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant