|
1 | 1 | import { FC, PropsWithChildren, useEffect } from 'react'; |
2 | 2 | import { FronteggProviderNoSSR } from '@frontegg/nextjs'; |
3 | 3 |
|
| 4 | + |
4 | 5 | const contextOptions = { |
5 | | - baseUrl: 'https://app-tzfpgdmacxhi.stg.frontegg.com', |
6 | | - clientId: 'b9e58548-4c78-4292-88bd-d3d6c9ee015b', |
7 | | -}; |
| 6 | + baseUrl: '', |
| 7 | + clientId: '', |
| 8 | +} |
8 | 9 |
|
9 | 10 | // eslint-disable-next-line |
10 | 11 | const createDynamicProvider = (options: any) => { |
| 12 | + |
| 13 | + |
11 | 14 | const dynamicProvider: FC<PropsWithChildren> = ({ children }) => { |
12 | | - console.log('DynamicProvider', typeof window); |
| 15 | + |
| 16 | + |
| 17 | + console.log("DynamicProvider", typeof window) |
13 | 18 | // eslint-disable-next-line react-hooks/rules-of-hooks |
14 | 19 | useEffect(() => { |
15 | | - console.log('DynamicProvider'); |
| 20 | + console.log('DynamicProvider') |
16 | 21 | }, []); |
17 | 22 |
|
18 | | - return ( |
19 | | - <FronteggProviderNoSSR |
20 | | - contextOptions={options} |
21 | | - customLoader |
22 | | - authOptions={{ |
23 | | - // isLoading:true, |
24 | | - keepSessionAlive: true, |
25 | | - // routes: { |
26 | | - // loginUrl: `/account/login/`, |
27 | | - // } |
28 | | - }} |
29 | | - themeOptions={{ |
30 | | - loginBox: { |
31 | | - signup: { |
32 | | - overrideSignupFields: ({ fields }) => { |
33 | | - return { |
34 | | - tomer: { |
35 | | - type: 'custom', |
36 | | - fieldType: 'input', |
37 | | - fieldProps: { |
38 | | - label: 'ds', |
39 | | - placeholder: 'ds', |
40 | | - type: 'text', |
41 | | - }, |
42 | | - }, |
43 | | - ...fields, |
44 | | - }; |
45 | | - }, |
46 | | - }, |
47 | | - }, |
48 | | - }} |
49 | | - > |
50 | | - {children} |
51 | | - </FronteggProviderNoSSR> |
52 | | - ); |
53 | | - }; |
| 23 | + return <FronteggProviderNoSSR contextOptions={options} |
| 24 | + customLoader |
| 25 | + authOptions={{ |
| 26 | + // isLoading:true, |
| 27 | + keepSessionAlive:true, |
| 28 | + // routes: { |
| 29 | + // loginUrl: `/account/login/`, |
| 30 | + // } |
| 31 | + }} |
| 32 | + themeOptions={{ |
| 33 | + loginBox: { |
| 34 | + signup: { |
| 35 | + overrideSignupFields: ({fields}) => { |
| 36 | + |
| 37 | + return { |
| 38 | + tomer: { |
| 39 | + type:'custom', |
| 40 | + fieldType:'input', |
| 41 | + fieldProps:{ |
| 42 | + label:"ds", |
| 43 | + placeholder:"ds", |
| 44 | + type:"text", |
| 45 | + |
| 46 | + |
| 47 | + } |
| 48 | + }, |
| 49 | + ...fields |
| 50 | + } |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | + }} |
| 55 | + > |
| 56 | + {children} |
| 57 | + </FronteggProviderNoSSR> |
| 58 | + } |
54 | 59 | return dynamicProvider; |
55 | | -}; |
| 60 | +} |
56 | 61 |
|
57 | 62 | const DynamicProvider = createDynamicProvider(contextOptions); |
58 | | -export default DynamicProvider; |
| 63 | +export default DynamicProvider |
0 commit comments