53 Replies
Hi @Sly. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To implement auto logout after 5 minutes of inactivity in a Refine application, you can use a combination of JavaScript's
setTimeout
and event listeners to track user activity. Below is a step-by-step guide to achieve this:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's useLogout
hook to log out the user.
Here is an example implementation:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be automatically logged out after 5 minutes of inactivity. The resetTimeout
function is called whenever there is user activity, resetting the timer.
For more information on using the useLogout
hook, you can refer to the Refine documentation (https://refine.dev/docs/authorization/access-control-provider/#performance).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai how to in typescript
Let me check the knowledge base for you. One moment! :books:
----------------------
To implement auto logout after 5 minutes of inactivity in a Refine application using TypeScript, you can follow these steps:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's
useLogout
hook to log out the user.
Here is an example implementation in TypeScript:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be automatically logged out after 5 minutes of inactivity. The resetTimeout
function is called whenever there is user activity, resetting the timer.
For more information on using the useLogout
hook, you can refer to the Refine documentation (https://refine.dev/docs/authentication/hooks/use-logout/#usage).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai im getting error in const AutoLogout: React.FC = ({ children }): it shows Property 'children' does not exist on type '{}'
Let me check the knowledge base for you. One moment! :books:
----------------------
The error you're encountering is because TypeScript doesn't know that the
children
prop is expected in the AutoLogout
component. To fix this, you need to explicitly define the type for the children
prop.
Here's how you can define the AutoLogout
component with the correct type for the children
prop:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be automatically logged out after 5 minutes of inactivity. The resetTimeout
function is called whenever there is user activity, resetting the timer.
For more information on using the useLogout
hook, you can refer to the Refine documentation (https://refine.dev/docs/authentication/hooks/use-logout/#usage).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai logout in 1min
Let me check the knowledge base for you. One moment! :books:
----------------------
To implement auto logout after 1 minute of inactivity in a Refine application using TypeScript, you can follow these steps:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's
useLogout
hook to log out the user.
Here is an example implementation in TypeScript:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be automatically logged out after 1 minute of inactivity. The resetTimeout
function is called whenever there is user activity, resetting the timer.
For more information on using the useLogout
hook, you can refer to the Refine documentation (https://refine.dev/docs/authentication/hooks/use-logout/#usage).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai logout in 10seconds
Let me check the knowledge base for you. One moment! :books:
----------------------
To implement auto logout after 10 seconds of inactivity in a Refine application using TypeScript, you can follow these steps:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's
useLogout
hook to log out the user.
Here is an example implementation in TypeScript:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be automatically logged out after 10 seconds of inactivity. The resetTimeout
function is called whenever there is user activity, resetting the timer.
For more information on using the useLogout
hook, you can refer to the Refine documentation (https://refine.dev/docs/authentication/hooks/use-logout/#usage).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai display a wornig message before logout
Let me check the knowledge base for you. One moment! :books:
----------------------
To display a warning message before logging out the user due to inactivity, you can use the
window.confirm
method to prompt the user. If the user confirms, proceed with the logout; otherwise, reset the timeout.
Here is an example implementation in TypeScript:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be prompted with a warning message after 10 seconds of inactivity. If the user confirms, the timeout is reset; otherwise, the user is logged out.
For more information on using the useLogout
hook, you can refer to the Refine documentation (https://refine.dev/docs/authentication/hooks/use-logout/#usage).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.aiuse antdesign notification
Let me check the knowledge base for you. One moment! :books:
----------------------
To display a warning message using Ant Design's notification system before logging out the user due to inactivity, you can use the
notification
component from Ant Design. Here is how you can implement it in a Refine application using TypeScript:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's useLogout
hook to log out the user.
4. Use Ant Design's notification: Display a warning notification before logging out.
Here is an example implementation:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be shown a warning notification after 10 seconds of inactivity. If the user does not interact with the application within the duration of the notification, they will be logged out.
For more information on using the useLogout
hook, you can refer to the Refine documentation (https://refine.dev/docs/authentication/hooks/use-logout/#usage).
For more information on Ant Design's notification component, you can refer to the Ant Design documentation (https://ant.design/components/notification).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai If the user confirms, proceed with the logout; otherwise, reset the timeout using antdesign notification
Let me check the knowledge base for you. One moment! :books:
----------------------
To display a warning message using Ant Design's notification system and proceed with the logout if the user confirms, or reset the timeout otherwise, you can use the
Modal.confirm
method from Ant Design. Here is how you can implement it in a Refine application using TypeScript:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's useLogout
hook to log out the user.
4. Use Ant Design's Modal.confirm
: Display a confirmation modal before logging out.
Here is an example implementation:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be shown a confirmation modal after 10 seconds of inactivity. If the user confirms, the timeout is reset; otherwise, the user is logged out.
For more information on using the useLogout
hook, you can refer to the Refine documentation (https://refine.dev/docs/authentication/hooks/use-logout/#usage).
For more information on Ant Design's Modal.confirm
component, you can refer to the Ant Design documentation (https://ant.design/components/modal/#Modal.confirm).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai display a countdown timer before 5 seconds
Let me check the knowledge base for you. One moment! :books:
----------------------
To display a countdown timer before logging out the user due to inactivity, you can use Ant Design's
notification
component to show a warning message with a countdown timer. Here is how you can implement it in a Refine application using TypeScript:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's useLogout
hook to log out the user.
4. Use Ant Design's notification
: Display a warning notification with a countdown timer before logging out.
Here is an example implementation:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be shown a warning notification with a countdown
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai ask a user to cancel if he needs more time
Let me check the knowledge base for you. One moment! :books:
----------------------
To display a warning message using Ant Design's notification system and ask the user to cancel if they need more time before logging out due to inactivity, you can use the
Modal.confirm
method from Ant Design. Here is how you can implement it in a Refine application using TypeScript:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's useLogout
hook to log out the user.
4. Use Ant Design's Modal.confirm
: Display a confirmation modal with a countdown timer before logging out.
Here is an example implementation:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be shown a confirmation modal with a countdown timer after 10 seconds of inactivity. If the user confirms, the timeout is reset; otherwise,
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai show the countdown decreasing
Let me check the knowledge base for you. One moment! :books:
----------------------
To display a countdown timer that decreases in real-time within the Ant Design
Modal.confirm
dialog, you can update the modal content dynamically. Here is how you can implement it in a Refine application using TypeScript:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's useLogout
hook to log out the user.
4. Use Ant Design's Modal.confirm
: Display a confirmation modal with a countdown timer before logging out.
Here is an example implementation:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the user will be shown a
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai how to hide the cancel button
Let me check the knowledge base for you. One moment! :books:
----------------------
To hide the cancel button in the Ant Design
Modal.confirm
dialog, you can set the cancelButtonProps
property to { style: { display: 'none' } }
. Here is how you can implement it in a Refine application using TypeScript:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's useLogout
hook to log out the user.
4. Use Ant Design's Modal.confirm
: Display a confirmation modal with a countdown timer before logging out, and hide the cancel button.
Here is an example implementation:
Usage
Wrap your main application component with the AutoLogout
component:
```tsx
import React from "react";
import { Refine } from "@refinedev/core";
import AutoLogout from "./AutoLogout"; // Adjust the import path as necessary
const App: React.FC = () => {
return (
<Refine>
<AutoLogout>
{/* Your application components */}
</AutoLogout>
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai it still showing up the modal notification when the user is logged out and the mouse is "mousemove", "keydown", "click"
Let me check the knowledge base for you. One moment! :books:
----------------------
To ensure that the modal notification does not show up when the user is already logged out, you can add a state to track whether the user is logged out and conditionally show the modal based on this state. Here is how you can implement it in a Refine application using TypeScript:
1. Set up the timeout function: Create a function that logs out the user after a specified period of inactivity.
2. Track user activity: Reset the timeout whenever the user interacts with the application.
3. Integrate with Refine's logout functionality: Use Refine's
useLogout
hook to log out the user.
4. Use Ant Design's Modal.confirm
: Display a confirmation modal with a countdown timer before logging out, and hide the cancel button.
5. Track logout state: Ensure the modal does not show up if the user is already logged out.
Here is an example implementation:
Usage
Wrap your main application component with the AutoLogout
component:
```tsx
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai if the user loggedin set setIsLoggedOut false
Let me check the knowledge base for you. One moment! :books:
----------------------
To ensure that the
isLoggedOut
state is set to false
when the user logs in, you can add a useEffect hook to monitor the login state and update isLoggedOut
accordingly. Here is the updated implementation:
Usage
Wrap your main application component with the AutoLogout
component:
This setup ensures that the isLoggedOut
state is
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai Monitor login state using authProvider
Let me check the knowledge base for you. One moment! :books:
----------------------
To monitor the login state using
authProvider
in a Refine application, you can use the checkAuth
method provided by the authProvider
. This method can be used to determine if the user is authenticated and update the isLoggedOut
state accordingly.
Here is how you can implement it:
1. Set up the authProvider
: Ensure that your authProvider
has a checkAuth
method that returns a promise indicating whether the user is authenticated.
2. Monitor login state: Use the checkAuth
method to update the isLoggedOut
state.
Here is an example implementation:
authProvider.ts
AutoLogout.tsx
``tsx
import React, { useEffect, useRef, ReactNode, useState } from "react";
import { useLogout, useAuthProvider } from "@refinedev/core";
import { Modal } from "antd";
interface AutoLogoutProps {
children: ReactNode;
}
const AutoLogout: React.FC<AutoLogoutProps> = ({ children }) => {
const { mutate: logout } = useLogout();
const authProvider = useAuthProvider();
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
const countdownRef = useRef<NodeJS.Timeout | null>(null);
const [countdown, setCountdown] = useState(5);
const [isLoggedOut, setIsLoggedOut] = useState(false);
const resetTimeout = () => {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
if (countdownRef.current) {
clearInterval(countdownRef.current);
}
setCountdown(5);
timeoutRef.current = setTimeout(() => {
if (!isLoggedOut) {
const modal = Modal.confirm({
title: "Inactivity Warning",
content:
You will be logged out in ${countdown} seconds. Do you need more time?,
okText: "Stay Logged In",
cancelButtonProps: { style: { display: 'none' } },
onOk: () => {
resetTimeout();
},
onCancel: () => {
logout();
setIsLoggedOut(true);
},
});
countdownRef.current = setInterval(() => {
setCountdown((prevCountdown) => {
if (prevCountdown <= 1) {
clearInterval(countdownRef.current!);
logout();
setIsLoggedOut(true);
modal.destroy();
return 0;
}
modal.update({
content:
You will be logged out in ${prevCountdown - 1} seconds. Do you need more time?`,
});
return prevCountdown - 1;
});
}, 1000);
}
}, 10 * 1000); // 10 seconds
};
useEffect(() => {
const events = ["mousemove", "keydown", "click"];
events.forEach((event) => window.addEventListener(event, resetTimeout));
resetTimeout(); // Initialize timeout on component mount
return
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai repeat the step
Let me check the knowledge base for you. One moment! :books:
----------------------
To monitor the login state using
authProvider
in a Refine application, you can use the checkAuth
method provided by the authProvider
. This method can be used to determine if the user is authenticated and update the isLoggedOut
state accordingly.
Here is how you can implement it:
1. Set up the authProvider
: Ensure that your authProvider
has a checkAuth
method that returns a promise indicating whether the user is authenticated.
2. Monitor login state: Use the checkAuth
method to update the isLoggedOut
state.
Step-by-Step Implementation
#### 1. Set up the authProvider
Ensure that your authProvider
has a checkAuth
method that returns a promise indicating whether the user is authenticated.
#### 2. Monitor login state
Use the checkAuth
method to update the isLoggedOut
state.
``tsx
import React, { useEffect, useRef, ReactNode, useState } from "react";
import { useLogout, useAuthProvider } from "@refinedev/core";
import { Modal } from "antd";
interface AutoLogoutProps {
children: ReactNode;
}
const AutoLogout: React.FC<AutoLogoutProps> = ({ children }) => {
const { mutate: logout } = useLogout();
const authProvider = useAuthProvider();
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
const countdownRef = useRef<NodeJS.Timeout | null>(null);
const [countdown, setCountdown] = useState(5);
const [isLoggedOut, setIsLoggedOut] = useState(false);
const resetTimeout = () => {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
if (countdownRef.current) {
clearInterval(countdownRef.current);
}
setCountdown(5);
timeoutRef.current = setTimeout(() => {
if (!isLoggedOut) {
const modal = Modal.confirm({
title: "Inactivity Warning",
content:
You will be logged out in ${countdown} seconds. Do you need more time?,
okText: "Stay Logged In",
cancelButtonProps: { style: { display: 'none' } },
onOk: () => {
resetTimeout();
},
onCancel: () => {
logout();
setIsLoggedOut(true);
},
});
countdownRef.current = setInterval(() => {
setCountdown((prevCountdown) => {
if (prevCountdown <= 1) {
clearInterval(countdownRef.current!);
logout();
setIsLoggedOut(true);
modal.destroy();
return 0;
}
modal.update({
content:
You will be logged out in ${prevCountdown - 1} seconds. Do you need more time?`,
});
return prevCountdown - 1;
});
}, 1000);
}
}, 10 * 1000); // 10 seconds
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai when the modal popup the events should be disabled
Let me check the knowledge base for you. One moment! :books:
----------------------
To ensure that user events are disabled when the modal pops up, you can add a flag to track whether the modal is open and conditionally add or remove event listeners based on this flag. Here is how you can implement it in a Refine application using TypeScript:
1. Set up the
authProvider
: Ensure that your authProvider
has a checkAuth
method that returns a promise indicating whether the user is authenticated.
2. Monitor login state: Use the checkAuth
method to update the isLoggedOut
state.
3. Disable events when the modal is open: Add a flag to track whether the modal is open and conditionally add or remove event listeners based on this flag.
Step-by-Step Implementation
#### 1. Set up the authProvider
Ensure that your authProvider
has a checkAuth
method that returns a promise indicating whether the user is authenticated.
#### 2. Monitor login state
Use the checkAuth
method to update the isLoggedOut
state.
#### 3. Disable events when the modal is open
Add a flag to track whether the modal is open and conditionally add or remove event listeners based on this flag.
``tsx
import React, { useEffect, useRef, ReactNode, useState } from "react";
import { useLogout, useAuthProvider } from "@refinedev/core";
import { Modal } from "antd";
interface AutoLogoutProps {
children: ReactNode;
}
const AutoLogout: React.FC<AutoLogoutProps> = ({ children }) => {
const { mutate: logout } = useLogout();
const authProvider = useAuthProvider();
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
const countdownRef = useRef<NodeJS.Timeout | null>(null);
const [countdown, setCountdown] = useState(5);
const [isLoggedOut, setIsLoggedOut] = useState(false);
const [isModalOpen, setIsModalOpen] = useState(false);
const resetTimeout = () => {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
if (countdownRef.current) {
clearInterval(countdownRef.current);
}
setCountdown(5);
timeoutRef.current = setTimeout(() => {
if (!isLoggedOut) {
setIsModalOpen(true);
const modal = Modal.confirm({
title: "Inactivity Warning",
content:
You will be logged out in ${countdown} seconds. Do you need more time?`,
okText: "Stay Logged In",
cancelButtonProps: { style: { display: 'none' } },
onOk: () => {
resetTimeout();
setIsModalOpen(false);
},
onCancel: () => {
logout();
setIsLoggedOut(true);
setIsModalOpen(false);
},
});
countdownRef.current = setInterval(() => {
setCountdown((prevCountdown) => {
if (prevCountdown <=
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below
correct-apricotOP•6mo ago
@kapa.ai why when modal is opened the events = ["mousemove", "keydown", "click"] stops countdown
Let me check the knowledge base for you. One moment! :books:
----------------------
When the modal is opened, the events
["mousemove", "keydown", "click"]
stop the countdown because the resetTimeout
function is being called on these events. This function clears the existing timeout and interval, effectively stopping the countdown.
To prevent this behavior, you need to disable these event listeners when the modal is open. You can achieve this by adding a flag to track whether the modal is open and conditionally add or remove event listeners based on this flag.
Here is how you can implement it:
Step-by-Step Implementation
#### 1. Set up the authProvider
Ensure that your authProvider
has a checkAuth
method that returns a promise indicating whether the user is authenticated.
#### 2. Monitor login state
Use the checkAuth
method to update the isLoggedOut
state.
#### 3. Disable events when the modal is open
Add a flag to track whether the modal is open and conditionally add or remove event listeners based on this flag.
``tsx
import React, { useEffect, useRef, ReactNode, useState } from "react";
import { useLogout, useAuthProvider } from "@refinedev/core";
import { Modal } from "antd";
interface AutoLogoutProps {
children: ReactNode;
}
const AutoLogout: React.FC<AutoLogoutProps> = ({ children }) => {
const { mutate: logout } = useLogout();
const authProvider = useAuthProvider();
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
const countdownRef = useRef<NodeJS.Timeout | null>(null);
const [countdown, setCountdown] = useState(5);
const [isLoggedOut, setIsLoggedOut] = useState(false);
const [isModalOpen, setIsModalOpen] = useState(false);
const resetTimeout = () => {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
if (countdownRef.current) {
clearInterval(countdownRef.current);
}
setCountdown(5);
timeoutRef.current = setTimeout(() => {
if (!isLoggedOut) {
setIsModalOpen(true);
const modal = Modal.confirm({
title: "Inactivity Warning",
content:
You will be logged out in ${countdown} seconds. Do you need more time?,
okText: "Stay Logged In",
cancelButtonProps: { style: { display: 'none' } },
onOk: () => {
resetTimeout();
setIsModalOpen(false);
},
onCancel: () => {
logout();
setIsLoggedOut(true);
setIsModalOpen(false);
},
});
countdownRef.current = setInterval(() => {
setCountdown((prevCountdown) => {
if (prevCountdown <= 1) {
clearInterval(countdownRef.current!);
logout();
setIsLoggedOut(true);
modal.destroy();
return 0;
}
modal.update({
content:
You will be logged out
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1172098337760096258> kapa.ai is still learning and improving, please let us know how it did by reacting below