From c4f5554872c56052a4cf5e7e9b52bae9e3fda50d Mon Sep 17 00:00:00 2001 From: Rakov Roman Date: Thu, 1 Sep 2022 13:06:11 +0300 Subject: [PATCH] fix(fix): some fixes --- src/config/clients/index.tsx | 1 + src/features/AuthStore/helpers.tsx | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/config/clients/index.tsx b/src/config/clients/index.tsx index 21bec8ae..72ddd498 100644 --- a/src/config/clients/index.tsx +++ b/src/config/clients/index.tsx @@ -14,6 +14,7 @@ export const isFacrClient = currentClient === 'facr' const clients = { facr, + insports, instat, lff, } diff --git a/src/features/AuthStore/helpers.tsx b/src/features/AuthStore/helpers.tsx index f538807b..46834890 100644 --- a/src/features/AuthStore/helpers.tsx +++ b/src/features/AuthStore/helpers.tsx @@ -4,6 +4,7 @@ import { WebStorageStateStore } from 'oidc-client' import { client } from 'config/clients' import { AUTH_SERVICE } from 'config/routes' import { ClientIds, ClientNames } from 'config/clients/types' +import { ENV, stageENV } from 'config/env' interface Settings extends UserManagerSettings { client_id: ClientIds, @@ -30,23 +31,17 @@ export const getClientNameByRedirectUri = () => { } const redirectUrl = () => { - return `${window.origin}/redirect` + const clientName = getClientNameByRedirectUri() + switch (true) { + case (process.env.NODE_ENV === 'development' || client.name === 'lff'): + return `${window.origin}/redirect` + case (ENV === 'staging' || ENV === 'preproduction'): + return `https://${stageENV}.insports.tv/redirect` + default: + return `https://${clientName}.tv/redirect` + } } -// const redirectUrl = () => { -// return 'https://insports.tv/redirect' -// const clientName = getClientNameByRedirectUri() -// switch (true) { -// case (process.env.NODE_ENV === 'development' || client.name === 'lff'): -// return `${window.origin}/redirect` -// case (ENV === 'staging' || ENV === 'preproduction'): -// // return `https://${stageENV}.insports.tv/redirect` -// return `${window.origin}/redirect` -// default: -// return `https://${clientName}.tv/redirect` -// } -// } - export const getClientSettings = (): Settings => ({ authority: AUTH_SERVICE, automaticSilentRenew: true,