Update May 21 by Elvis

This commit is contained in:
belviskhoremk
2026-05-21 22:24:22 +00:00
parent 57f3311278
commit 342ba2c867
12 changed files with 71 additions and 59 deletions

View File

@@ -1,6 +1,6 @@
"use client";
import React, { useContext, useState, useEffect, ReactNode, createContext } from "react";
import React, { useContext, useState, useEffect, startTransition, ReactNode, createContext } from "react";
import { useAuth } from "@/contexts/AuthContext";
import * as productsApi from "@/lib/api/products";
import * as bookingsApi from "@/lib/api/bookings";
@@ -82,8 +82,10 @@ export const AdminProvider = ({ children }: { children: ReactNode }) => {
useEffect(() => {
if (isAdmin) {
refreshProducts();
refreshReservations();
startTransition(() => {
refreshProducts();
refreshReservations();
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isAdmin]);

View File

@@ -1,6 +1,6 @@
"use client";
import React, { createContext, useContext, useState, useEffect, ReactNode } from "react";
import React, { createContext, useContext, useState, useEffect, startTransition, ReactNode } from "react";
import { getToken } from "@/lib/api";
import * as authApi from "@/lib/api/auth";
@@ -24,7 +24,7 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
useEffect(() => {
const token = getToken();
if (!token) {
setIsLoading(false);
startTransition(() => setIsLoading(false));
return;
}
authApi.getMe()