ok
This commit is contained in:
@@ -20,7 +20,7 @@ import Header from "../components/Header";
|
||||
|
||||
import { ThreeDots } from "react-loader-spinner";
|
||||
|
||||
import { updateLocalStorage, removeLocalStorage } from "../helpers/localStorageHelpers";
|
||||
import { getLocalStorage, updateLocalStorage, removeLocalStorage } from "../helpers/localStorageHelpers";
|
||||
import { unsubscribeUser } from "../helpers/subscribeHelpers.js";
|
||||
import WelcomePage from "./WelcomePage.js";
|
||||
|
||||
@@ -94,8 +94,29 @@ function CafePage({
|
||||
// Navigate to the new cafeId while keeping existing params
|
||||
navigate(`/${user.cafeId}?${currentParams}`, { replace: true });
|
||||
}
|
||||
|
||||
}, [user, shopId]);
|
||||
|
||||
useEffect(() => {
|
||||
function fetchData() {
|
||||
console.log(user.userId == shopOwnerId)
|
||||
setModal("create_item");
|
||||
|
||||
}
|
||||
console.log(getLocalStorage('auth'))
|
||||
if (getLocalStorage("auth") != null) {
|
||||
const executeFetch = async () => {
|
||||
while (user.length == 0) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100)); // Wait until the user is not null
|
||||
}
|
||||
console.log(user)
|
||||
console.log('open')
|
||||
if (user.length != 0 && user.userId == shopOwnerId && shopItems.length == 0) fetchData();
|
||||
};
|
||||
executeFetch();
|
||||
}
|
||||
}, [user, shopItems]);
|
||||
|
||||
useEffect(() => {
|
||||
if (token) {
|
||||
updateLocalStorage("auth", token);
|
||||
@@ -172,12 +193,12 @@ function CafePage({
|
||||
setIsEditMode={(e) => setIsEditMode(e)}
|
||||
isEditMode={isEditMode}
|
||||
/>
|
||||
<MusicPlayer
|
||||
socket={socket}
|
||||
shopId={shopId}
|
||||
user={user}
|
||||
isSpotifyNeedLogin={isSpotifyNeedLogin}
|
||||
/>
|
||||
<MusicPlayer
|
||||
socket={socket}
|
||||
shopId={shopId}
|
||||
user={user}
|
||||
isSpotifyNeedLogin={isSpotifyNeedLogin}
|
||||
/>
|
||||
<ItemTypeLister
|
||||
user={user}
|
||||
shopOwnerId={shopOwnerId}
|
||||
|
||||
Reference in New Issue
Block a user