Merge branch 'dev' into 'staging'
Dev See merge request frontend/squiz!310
This commit is contained in:
commit
9d93f0f159
@ -283,8 +283,8 @@ export default function App() {
|
|||||||
path={"/qaz"}
|
path={"/qaz"}
|
||||||
element={<LazyLoading children={<InfoPrivilege />} />}
|
element={<LazyLoading children={<InfoPrivilege />} />}
|
||||||
/>
|
/>
|
||||||
|
<Route path={"/image/:srcImage"} element={<ChatImageNewWindow />} />
|
||||||
<Route element={<PrivateRoute />}>
|
<Route element={<PrivateRoute />}>
|
||||||
<Route path={"/image/:srcImage"} element={<ChatImageNewWindow />} />
|
|
||||||
{routeslink.map((e, i) => (
|
{routeslink.map((e, i) => (
|
||||||
<Route
|
<Route
|
||||||
key={i}
|
key={i}
|
||||||
|
|||||||
@ -12,18 +12,20 @@ import { parseAxiosError } from "@utils/parse-error";
|
|||||||
import type { Discount } from "@model/discounts";
|
import type { Discount } from "@model/discounts";
|
||||||
|
|
||||||
export function CheckFastlink() {
|
export function CheckFastlink() {
|
||||||
const userId = useUserStore((state) => state.userId);
|
const user = useUserStore();
|
||||||
const [discounts, setDiscounts] = useState<Discount[]>([]);
|
const [discounts, setDiscounts] = useState<Discount[]>([]);
|
||||||
const [askToChange, setAskToChange] = useState(false);
|
const [askToChange, setAskToChange] = useState(false);
|
||||||
const [promocode, setPromocode] = useState("");
|
const [promocode, setPromocode] = useState("");
|
||||||
|
console.log(
|
||||||
|
user.userAccount,
|
||||||
|
user.customerAccount)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const get = async () => {
|
const get = async () => {
|
||||||
if (!userId) {
|
if (!user.userId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [discounts] = await getDiscounts(userId);
|
const [discounts] = await getDiscounts(user.userId);
|
||||||
|
|
||||||
if (discounts?.length) {
|
if (discounts?.length) {
|
||||||
setDiscounts(discounts);
|
setDiscounts(discounts);
|
||||||
@ -75,16 +77,19 @@ export function CheckFastlink() {
|
|||||||
if (flLS !== null && flLS.length > 0) {
|
if (flLS !== null && flLS.length > 0) {
|
||||||
setPromocode(flLS);
|
setPromocode(flLS);
|
||||||
|
|
||||||
if (userId !== null) {
|
if (user.userId !== null) {
|
||||||
//У нас есть промокод и юзер авторизован. Проверяем есть ли у него применённый промокод
|
//У нас есть промокод и юзер авторизован. Проверяем есть ли у него применённый промокод
|
||||||
if (discounts?.find((e) => e.Condition.User === userId)) {
|
//Проверяем были ли запросы на аккаунт и кастомер аккаунт
|
||||||
setAskToChange(true);
|
if (user.userAccount !== null && user.customerAccount !== null) {
|
||||||
} else {
|
if (discounts?.find((e) => e.Condition.User === user.userId)) {
|
||||||
fetchPromocode();
|
setAskToChange(true);
|
||||||
|
} else {
|
||||||
|
fetchPromocode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [userId, discounts]);
|
}, [user.userId, discounts]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user