Merge branch 'AW-68-userIdYandexMetric' into 'develop'
AW-68-userIdYandexMetric See merge request witapp/aura-webapp!120
This commit is contained in:
commit
d521532ae2
@ -174,6 +174,7 @@ export interface ICreateAuthorizePayload {
|
||||
|
||||
export interface ICreateAuthorizeResponse {
|
||||
token: string;
|
||||
userId?: string;
|
||||
}
|
||||
|
||||
export const createAuthorizeRequest = (data: ICreateAuthorizePayload): Request => {
|
||||
|
||||
@ -114,7 +114,13 @@ export const useAuthentication = () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const payload = getAuthorizationPayload(email, source);
|
||||
const { token } = await api.authorization(payload);
|
||||
const { token, userId } = await api.authorization(payload);
|
||||
if (userId?.length && !!window.ym) {
|
||||
window.ym(95799066, 'userParams', {
|
||||
UserID: userId
|
||||
})
|
||||
window.ym(95799066, 'setUserID', userId);
|
||||
}
|
||||
const { user } = await api.getUser({ token });
|
||||
signUp(token, user);
|
||||
setToken(token);
|
||||
|
||||
@ -22,3 +22,11 @@ export interface SignupForm {
|
||||
}
|
||||
|
||||
export type UserStatus = "lead" | "registred" | "subscribed" | "unsubscribed";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
ym: any;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user