Replaced duplication getCookie

This commit is contained in:
Alexey Safronov 2023-11-23 22:48:30 +04:00
parent 453318ed29
commit 68a1456e8c

View File

@ -4,6 +4,7 @@ import { isMobile, isIOS } from "react-device-detect";
import { inject, observer } from "mobx-react";
import { useLocation } from "react-router-dom";
import SmartBanner from "react-smartbanner";
import { getCookie } from "@docspace/components/utils/cookie";
import "./main.css";
const Wrapper = styled.div`
@ -15,17 +16,6 @@ const ReactSmartBanner = (props) => {
const force = isIOS ? "ios" : "android";
const location = useLocation();
const getCookie = (name) => {
let matches = document.cookie.match(
new RegExp(
"(?:^|; )" +
name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") +
"=([^;]*)"
)
);
return matches ? decodeURIComponent(matches[1]) : undefined;
};
const checkBanner = () => {
const cookieClosed = getCookie("smartbanner-closed");
const cookieInstalled = getCookie("smartbanner-installed");