fixed refresh-token error and changed forgot password text position.
This commit is contained in:
parent
29caa20250
commit
d4452ae19a
@ -61,7 +61,7 @@ const LoginPage = () => {
|
||||
className="mb-3"
|
||||
onSubmit={handleSubmit(onSubmit)}
|
||||
>
|
||||
<div className="mb-0">
|
||||
<div className="mb-2">
|
||||
<label htmlFor="username" className="form-label">
|
||||
Email or Username
|
||||
</label>
|
||||
@ -84,16 +84,11 @@ const LoginPage = () => {
|
||||
)}
|
||||
</div>
|
||||
<div className="mb-3 form-password-toggle">
|
||||
<div className="d-flex justify-content-between">
|
||||
<div className="d-flex justify-content-center">
|
||||
<label className="form-label" htmlFor="password">
|
||||
Password
|
||||
</label>
|
||||
<Link
|
||||
aria-label="Go to Forgot Password Page"
|
||||
to="/auth/forgot-password"
|
||||
>
|
||||
<small>Forgot Password?</small>
|
||||
</Link>
|
||||
|
||||
</div>
|
||||
<div className="input-group input-group-merge">
|
||||
<input
|
||||
@ -126,8 +121,8 @@ const LoginPage = () => {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<div className="form-check">
|
||||
<div className="mb-3 d-flex justify-content-between">
|
||||
<div className="form-check d-flex">
|
||||
<input
|
||||
className="form-check-input"
|
||||
type="checkbox"
|
||||
@ -135,11 +130,17 @@ const LoginPage = () => {
|
||||
name="rememberMe"
|
||||
{...register("rememberMe")}
|
||||
/>
|
||||
<label className="form-check-label" htmlFor="remember-me">
|
||||
<label className="form-check-label ms-2" htmlFor="remember-me">
|
||||
{" "}
|
||||
Remember Me{" "}
|
||||
</label>
|
||||
</div>
|
||||
<Link
|
||||
aria-label="Go to Forgot Password Page"
|
||||
to="/auth/forgot-password"
|
||||
>
|
||||
<span>Forgot Password?</span>
|
||||
</Link>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<button
|
||||
|
@ -11,7 +11,9 @@ import { hasUserPermission } from "../../utils/authUtils";
|
||||
import { MANAGE_EMPLOYEES } from "../../utils/constants";
|
||||
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
||||
|
||||
const EmployeeList = () => {
|
||||
const EmployeeList = () =>
|
||||
{
|
||||
|
||||
const { profile: loginUser } = useProfile();
|
||||
const [selectedProject, setSelectedProject] = useState("");
|
||||
const { projects, loading: projectLoading } = useProjects();
|
||||
|
@ -31,9 +31,11 @@ axiosClient.interceptors.request.use(
|
||||
// // Response interceptor to handle responses globally (optional)
|
||||
// Add an interceptor to handle expired tokens
|
||||
axiosClient.interceptors.response.use(
|
||||
|
||||
|
||||
(response) => response,
|
||||
async (error) => {
|
||||
// debugger;
|
||||
debugger;
|
||||
const originalRequest = error.config;
|
||||
|
||||
if (!originalRequest) {
|
||||
@ -48,28 +50,47 @@ axiosClient.interceptors.response.use(
|
||||
console.error(
|
||||
"Connection refused. Please ensure the server is running."
|
||||
);
|
||||
|
||||
if ( error.config.url.indexOf( 'refresh-token' ) == -1 )
|
||||
{
|
||||
showToast("Server is unreachable. Try again later!", "error");
|
||||
}
|
||||
showToast(
|
||||
"Unable to connect to the server. Please try again later.",
|
||||
"error"
|
||||
);
|
||||
} else if (error.code === "ERR_NETWORK") {
|
||||
console.error("Network error: Unable to reach the server.");
|
||||
showToast("Server is unreachable. Try again later!", "error");
|
||||
console.error( "Network error: Unable to reach the server." );
|
||||
if ( error.config.url.indexOf( 'refresh-token' ) == -1 )
|
||||
{
|
||||
showToast("Server is unreachable. Try again later!", "error");
|
||||
}
|
||||
redirectToLogin();
|
||||
} else if (error.code === "ECONNABORTED") {
|
||||
console.error("Request timed out.");
|
||||
console.error( "Request timed out." );
|
||||
|
||||
if ( error.config.url.indexOf( 'refresh-token' ) == -1 )
|
||||
{
|
||||
showToast("Server is unreachable. Try again later!", "error");
|
||||
}
|
||||
showToast(
|
||||
"The request took too long. Please try again later.",
|
||||
"error"
|
||||
);
|
||||
} else if (error.response) {
|
||||
} else if ( error.response )
|
||||
{
|
||||
|
||||
if ( error.config.url.indexOf( 'refresh-token' ) == -1 )
|
||||
{
|
||||
showToast("Server is unreachable. Try again later!", "error");
|
||||
}
|
||||
showToast(error.response.data.message, "error");
|
||||
|
||||
if (error.response.status === 401 && !originalRequest._retry) {
|
||||
originalRequest._retry = true;
|
||||
|
||||
try {
|
||||
// debugger;
|
||||
|
||||
// Get the refresh token from secure storage
|
||||
const refreshToken = localStorage.getItem("refreshToken");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user