diff --git a/src/App.tsx b/src/App.tsx
index 9b451632..1ce92906 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -283,8 +283,8 @@ export default function App() {
path={"/qaz"}
element={} />}
/>
+ } />
}>
- } />
{routeslink.map((e, i) => (
state.userId);
+ const user = useUserStore();
const [discounts, setDiscounts] = useState([]);
const [askToChange, setAskToChange] = useState(false);
const [promocode, setPromocode] = useState("");
-
+ console.log(
+ user.userAccount,
+ user.customerAccount)
useEffect(() => {
const get = async () => {
- if (!userId) {
+ if (!user.userId) {
return;
}
- const [discounts] = await getDiscounts(userId);
+ const [discounts] = await getDiscounts(user.userId);
if (discounts?.length) {
setDiscounts(discounts);
@@ -75,16 +77,19 @@ export function CheckFastlink() {
if (flLS !== null && flLS.length > 0) {
setPromocode(flLS);
- if (userId !== null) {
+ if (user.userId !== null) {
//У нас есть промокод и юзер авторизован. Проверяем есть ли у него применённый промокод
- if (discounts?.find((e) => e.Condition.User === userId)) {
- setAskToChange(true);
- } else {
- fetchPromocode();
+ //Проверяем были ли запросы на аккаунт и кастомер аккаунт
+ if (user.userAccount !== null && user.customerAccount !== null) {
+ if (discounts?.find((e) => e.Condition.User === user.userId)) {
+ setAskToChange(true);
+ } else {
+ fetchPromocode();
+ }
}
}
}
- }, [userId, discounts]);
+ }, [user.userId, discounts]);
return (