@c-rex/contexts 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-rex/contexts",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -14,9 +14,12 @@ type AppConfigContextType = {
14
14
  uiLang: string | null
15
15
  contentLang: string | null
16
16
  availableVersions: SidebarAvailableVersionsInterface[] | null
17
+ packageID: string | null
17
18
  setUiLang: (lang: string | null) => void
18
19
  setContentLang: (lang: string | null) => void
19
20
  setAvailableVersions: (versions: SidebarAvailableVersionsInterface[] | null) => void
21
+ setLoading: (loading: boolean) => void,
22
+ setPackageID: (lang: string | null) => void
20
23
  }
21
24
 
22
25
  const AppConfigContext = createContext<AppConfigContextType | undefined>(undefined)
@@ -27,6 +30,7 @@ export const AppConfigProvider = ({ children }: { children: React.ReactNode }) =
27
30
  const [availableVersions, setAvailableVersions] = useState<SidebarAvailableVersionsInterface[] | null>(null)
28
31
  const [loading, setLoading] = useState(true)
29
32
  const [uiLang, setUiLang] = useState<string | null>(null)
33
+ const [packageID, setPackageID] = useState<string | null>(null)
30
34
  const [contentLang, setContentLang] = useState<string | null>(null)
31
35
  const [error, setError] = useState<Error | null>(null)
32
36
 
@@ -64,8 +68,6 @@ export const AppConfigProvider = ({ children }: { children: React.ReactNode }) =
64
68
  try {
65
69
  const hasToken = await getCookie(CREX_TOKEN_HEADER_KEY);
66
70
 
67
- console.log(hasToken)
68
-
69
71
  if (hasToken.value === null) {
70
72
  await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/token`, {
71
73
  method: 'POST',
@@ -89,7 +91,6 @@ export const AppConfigProvider = ({ children }: { children: React.ReactNode }) =
89
91
 
90
92
  useEffect(() => {
91
93
  const load = async () => {
92
- console.log('load')
93
94
  try {
94
95
  setLoading(true)
95
96
 
@@ -135,6 +136,9 @@ export const AppConfigProvider = ({ children }: { children: React.ReactNode }) =
135
136
  setContentLang,
136
137
  availableVersions,
137
138
  setAvailableVersions,
139
+ setLoading,
140
+ packageID,
141
+ setPackageID
138
142
  }}
139
143
  >
140
144
  {loading ? loadingComp : children}