сбор информации пользователя
This commit is contained in:
parent
7bec600391
commit
954a0fbf0c
@ -1,5 +1,7 @@
|
|||||||
import { GetQuizDataResponse, parseQuizData } from "@model/api/getQuizData";
|
import { GetQuizDataResponse, parseQuizData } from "@model/api/getQuizData";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import MobileDetect from 'mobile-detect';
|
||||||
|
import device from "current-device";
|
||||||
|
|
||||||
import type { AxiosError } from "axios";
|
import type { AxiosError } from "axios";
|
||||||
import { replaceSpacesToEmptyLines } from "../components/ViewPublicationPage/tools/replaceSpacesToEmptyLines";
|
import { replaceSpacesToEmptyLines } from "../components/ViewPublicationPage/tools/replaceSpacesToEmptyLines";
|
||||||
@ -9,12 +11,26 @@ let SESSIONS = "";
|
|||||||
|
|
||||||
const domain = location.hostname === "hbpn.link" ? "" : "https://s.hbpn.link";
|
const domain = location.hostname === "hbpn.link" ? "" : "https://s.hbpn.link";
|
||||||
|
|
||||||
|
const md = new MobileDetect(window.navigator.userAgent);
|
||||||
|
|
||||||
|
const userAgent = navigator.userAgent
|
||||||
|
let OSDevice = md.os()
|
||||||
|
if (OSDevice === null) {OSDevice = userAgent}
|
||||||
|
|
||||||
|
const DeviceType = device.type
|
||||||
|
let Device = md.mobile()
|
||||||
|
if (Device === null) {Device = userAgent}
|
||||||
|
|
||||||
export const publicationMakeRequest = ({ url, body }: any) => {
|
export const publicationMakeRequest = ({ url, body }: any) => {
|
||||||
return axios(url, {
|
return axios(url, {
|
||||||
data: body,
|
data: body,
|
||||||
headers: {
|
headers: {
|
||||||
"X-Sessionkey": SESSIONS,
|
"X-Sessionkey": SESSIONS,
|
||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
|
"DeviceType" : DeviceType,
|
||||||
|
"Device" : Device,
|
||||||
|
"OS": OSDevice,
|
||||||
|
"Browser" : userAgent
|
||||||
},
|
},
|
||||||
method: "POST",
|
method: "POST",
|
||||||
});
|
});
|
||||||
|
@ -86,6 +86,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"country-flag-emoji-polyfill": "^0.1.8",
|
"country-flag-emoji-polyfill": "^0.1.8",
|
||||||
"hex-rgb": "^5.0.0"
|
"current-device": "^0.10.2",
|
||||||
|
"hex-rgb": "^5.0.0",
|
||||||
|
"mobile-detect": "^1.4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
yarn.lock
10
yarn.lock
@ -1593,6 +1593,11 @@ csstype@^3.0.2, csstype@^3.1.2:
|
|||||||
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
|
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
|
||||||
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
|
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
|
||||||
|
|
||||||
|
current-device@^0.10.2:
|
||||||
|
version "0.10.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/current-device/-/current-device-0.10.2.tgz#1e40176bee7da655383ab7245b853fae7d2dfc8e"
|
||||||
|
integrity sha512-FN223n2Cp1fRI/gyjJEAdagHhJ/2Z2STz3tUg1t4F259BhmVRCChkmxcgFtjYJsWuIacQEs7bqJpnAczIXIkWw==
|
||||||
|
|
||||||
cypress@^13.6.1:
|
cypress@^13.6.1:
|
||||||
version "13.6.3"
|
version "13.6.3"
|
||||||
resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.6.3.tgz#54f03ca07ee56b2bc18211e7bd32abd2533982ba"
|
resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.6.3.tgz#54f03ca07ee56b2bc18211e7bd32abd2533982ba"
|
||||||
@ -2687,6 +2692,11 @@ minimist@^1.2.8:
|
|||||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
|
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
|
||||||
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
|
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
|
||||||
|
|
||||||
|
mobile-detect@^1.4.5:
|
||||||
|
version "1.4.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/mobile-detect/-/mobile-detect-1.4.5.tgz#da393c3c413ca1a9bcdd9ced653c38281c0fb6ad"
|
||||||
|
integrity sha512-yc0LhH6tItlvfLBugVUEtgawwFU2sIe+cSdmRJJCTMZ5GEJyLxNyC/NIOAOGk67Fa8GNpOttO3Xz/1bHpXFD/g==
|
||||||
|
|
||||||
moment@^2.30.1:
|
moment@^2.30.1:
|
||||||
version "2.30.1"
|
version "2.30.1"
|
||||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
|
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
|
||||||
|
Loading…
Reference in New Issue
Block a user