---
title: "Comment by Kakamotobi on \"Authentication & Refresh token flow with Nextjs, Typescript, React Query and axios interceptors.\" | Hashnode"
description: "In the catch in the response interceptor, wouldn&#39;t the toast disappear right away due to window.location.href = window.location.origin ?"
url: "https://hashnode.com/posts/authentication-refresh-token-flow-with-nextjs-typescript-react-query-and-axios-interceptors/6371d17cfb40eef9d39b7930/comment/64f5f080f6310e9375f96364"
---

[Discussion](https://hashnode.com/posts/authentication-refresh-token-flow-with-nextjs-typescript-react-query-and-axios-interceptors/6371d17cfb40eef9d39b7930)

Comment [Authentication & Refresh token flow with Nextjs, Typescript, React Query and axios interceptors.](https://hashnode.com/posts/authentication-refresh-token-flow-with-nextjs-typescript-react-query-and-axios-interceptors/6371d17cfb40eef9d39b7930)

[Kakamotobi](https://hashnode.com/@Kakamotobi)

[Sep 4, 2023](https://hashnode.com/posts/authentication-refresh-token-flow-with-nextjs-typescript-react-query-and-axios-interceptors/6371d17cfb40eef9d39b7930/comment/64f5f080f6310e9375f96364)

In the `catch` in the response interceptor, wouldn't the toast disappear right away due to `window.location.href = window.location.origin`?

[K Srinivas Rao](https://hashnode.com/@srini53168)

[Sep 4, 2023](https://hashnode.com/posts/authentication-refresh-token-flow-with-nextjs-typescript-react-query-and-axios-interceptors/6371d17cfb40eef9d39b7930/comment/64f5f080f6310e9375f96364#reply-64f5f27ff6310e9375f96393)

Hey,

This code does have some flaws, it is meant for explaining the concept to someone starting out. I'll be writing a series of articles on production grade authentication which is going to cover everything in depth with the latest tools and patterns, stay tuned!

[Kakamotobi](https://hashnode.com/@Kakamotobi)

[Sep 4, 2023](https://hashnode.com/posts/authentication-refresh-token-flow-with-nextjs-typescript-react-query-and-axios-interceptors/6371d17cfb40eef9d39b7930/comment/64f5f080f6310e9375f96364#reply-64f5fbbdf6310e9375f964b1)

Right. I pointed it out because I have the same issue of trying to redirect the user to the signin page while keeping the toast rendered.
