File tree 5 files changed +4
-24
lines changed
5 files changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import airplaneDining from "@/assets/img/airways/airplaneDining.jpg";
11
11
import { FlightCalendar } from "@/components/ui/airwayscomponents/flightCalendar" ;
12
12
import { AnimatePresence } from "framer-motion" ;
13
13
import LoginHomePage from "@/components/LoginHomePage" ;
14
- import { setCookie } from "cookies-next" ;
15
14
import { Toaster } from "@/components/ui/toaster" ;
16
15
17
16
import AirlineHero from "@/components/ui/airwayscomponents/airlineHero" ;
@@ -56,10 +55,6 @@ export default function Airways() {
56
55
57
56
function handleLogout ( ) {
58
57
logoutUser ( ) ;
59
- const context : any = ldclient ?. getContext ( ) ;
60
- context . user . tier = null ;
61
- ldclient ?. identify ( context ) ;
62
- setCookie ( "ldcontext" , context ) ;
63
58
}
64
59
65
60
function bookTrip ( ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import { CreditAccount } from "@/components/ui/bankcomponents/creditview";
5
5
import { MorgtgageAccount } from "@/components/ui/bankcomponents/mortgageview" ;
6
6
import { useFlags , useLDClient } from "launchdarkly-react-client-sdk" ;
7
7
import { checkData } from "@/lib/checkingdata" ;
8
- import { setCookie } from "cookies-next" ;
9
8
import LoginContext from "@/utils/contexts/login" ;
10
9
import { FederatedCheckingAccount } from "@/components/ui/bankcomponents/federatedChecking" ;
11
10
import { FederatedCreditAccount } from "@/components/ui/bankcomponents/federatedCredit" ;
@@ -94,10 +93,6 @@ export default function Bank() {
94
93
95
94
function handleLogout ( ) {
96
95
logoutUser ( ) ;
97
- const context : any = ldclient ?. getContext ( ) ;
98
- context . user . tier = null ;
99
- ldclient ?. identify ( context ) ;
100
- setCookie ( "ldcontext" , context ) ;
101
96
}
102
97
103
98
const bankingServicesArr = [
Original file line number Diff line number Diff line change 1
1
import { useContext } from "react" ;
2
2
import { motion } from "framer-motion" ;
3
3
import { Toaster } from "@/components/ui/toaster" ;
4
- import { useLDClient } from "launchdarkly-react-client-sdk" ;
5
4
import NavBar from "@/components/ui/navbar" ;
6
5
import { AnimatePresence } from "framer-motion" ;
7
6
import LoginHomePage from "@/components/LoginHomePage" ;
8
- import { setCookie } from "cookies-next" ;
9
7
import LoginContext from "@/utils/contexts/login" ;
10
8
import InvestmentAccountHeader from "@/components/ui/investmentcomponents/InvestmentAccountHeader" ;
11
9
@@ -21,16 +19,10 @@ import RecentTradesCard from "@/components/ui/investmentcomponents/RecentTradesC
21
19
export default function Investment ( ) {
22
20
const { isLoggedIn, logoutUser } = useContext ( LoginContext ) ;
23
21
24
- const ldclient = useLDClient ( ) ;
25
-
26
22
//TODO: either use this or the one in login.js
27
23
//TODO: move this into navbar
28
24
function handleLogout ( ) {
29
25
logoutUser ( ) ;
30
- const context : any = ldclient ?. getContext ( ) ;
31
- context . user . tier = null ;
32
- ldclient ?. identify ( context ) ;
33
- setCookie ( "ldcontext" , context ) ;
34
26
}
35
27
36
28
const cardStyle = "rounded-lg shadow-lg p-5 sm:p-5 bg-white" ;
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ import { ReactSearchAutocomplete } from "react-search-autocomplete";
12
12
import { AnimatePresence } from "framer-motion" ;
13
13
import { Toaster } from "@/components/ui/toaster" ;
14
14
import LoginContext from "@/utils/contexts/login" ;
15
- import { setCookie } from "cookies-next" ;
16
15
17
16
export default function Marketplace ( ) {
18
17
const [ headerLabel , setHeaderLabel ] = useState < string > ( "" ) ;
@@ -264,10 +263,6 @@ export default function Marketplace() {
264
263
265
264
function handleLogout ( ) {
266
265
logoutUser ( ) ;
267
- const context : any = LDClient ?. getContext ( ) ;
268
- context . user . tier = null ;
269
- LDClient ?. identify ( context ) ;
270
- setCookie ( "ldcontext" , context ) ;
271
266
}
272
267
273
268
useEffect ( ( ) => {
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ export const LoginProvider = ({ children }) => {
38
38
context . audience . key = uuidv4 ( ) . slice ( 0 , 10 ) ;
39
39
context . user . launchclub = launchClubStatus ;
40
40
await client ?. identify ( context ) ;
41
+ setCookie ( "ld-context" , context ) ;
41
42
setIsLoggedIn ( true ) ;
42
43
setUser ( user ) ;
43
44
setEmail ( email ) ;
@@ -57,14 +58,16 @@ export const LoginProvider = ({ children }) => {
57
58
setLaunchClubStatus ( "standard" ) ;
58
59
const context = await createAnonymousContext ( ) ;
59
60
await client ?. identify ( context ) ;
61
+ setCookie ( "ld-context" , context ) ;
60
62
console . log ( "Anonymous User" , context ) ;
61
63
} ;
62
64
63
65
const createAnonymousContext = async ( ) => {
64
66
return {
65
67
"kind" : "multi" ,
66
68
"user" : {
67
- "anonymous" : true
69
+ "anonymous" : true ,
70
+ "tier" :null
68
71
} ,
69
72
"device" : {
70
73
"key" : device ,
You can’t perform that action at this time.
0 commit comments