mirror of
http://88.130.71.182:3000/BlitTech/badoHair_fe.git
synced 2026-06-13 08:47:35 +00:00
Update May 21 by Elvis
This commit is contained in:
@@ -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]);
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user