@c-rex/contexts 0.1.16 → 0.1.17
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 +1 -1
- package/src/config-provider.tsx +1 -13
package/package.json
CHANGED
package/src/config-provider.tsx
CHANGED
|
@@ -10,7 +10,6 @@ import { useLanguageStore } from '@c-rex/components/language-store'
|
|
|
10
10
|
type AppConfigContextType = {
|
|
11
11
|
error: Error | null
|
|
12
12
|
configs: CookiesConfigs
|
|
13
|
-
loading: boolean
|
|
14
13
|
packageID: string | null
|
|
15
14
|
articleLang: string | null
|
|
16
15
|
availableVersions: AvailableVersionsInterface[] | null
|
|
@@ -37,7 +36,6 @@ export const AppConfigProvider = ({
|
|
|
37
36
|
}: AppConfigProviderProps) => {
|
|
38
37
|
|
|
39
38
|
const [error, setError] = useState<Error | null>(null)
|
|
40
|
-
const [loading, setLoading] = useState(true)
|
|
41
39
|
const [packageID, setPackageID] = useState<string | null>(null)
|
|
42
40
|
const [articleLang, setArticleLang] = useState<string | null>(null)
|
|
43
41
|
const [availableVersions, setAvailableVersions] = useState<AvailableVersionsInterface[] | null>(null)
|
|
@@ -89,7 +87,6 @@ export const AppConfigProvider = ({
|
|
|
89
87
|
|
|
90
88
|
const load = async () => {
|
|
91
89
|
try {
|
|
92
|
-
setLoading(true)
|
|
93
90
|
await manageToken()
|
|
94
91
|
setError(null)
|
|
95
92
|
} catch (err) {
|
|
@@ -98,25 +95,16 @@ export const AppConfigProvider = ({
|
|
|
98
95
|
message: `config-provider.load error: ${err}`
|
|
99
96
|
});
|
|
100
97
|
setError(err as Error)
|
|
101
|
-
} finally {
|
|
102
|
-
setLoading(false)
|
|
103
98
|
}
|
|
104
99
|
}
|
|
105
100
|
|
|
106
101
|
load()
|
|
107
102
|
}, [])
|
|
108
103
|
|
|
109
|
-
const loadingComp = (
|
|
110
|
-
<div className="flex items-center justify-center min-h-screen bg-white">
|
|
111
|
-
<div className="animate-spin rounded-full h-12 w-12 border-2 border-gray-300 border-t-gray-950" />
|
|
112
|
-
</div>
|
|
113
|
-
)
|
|
114
|
-
|
|
115
104
|
return (
|
|
116
105
|
<AppConfigContext.Provider
|
|
117
106
|
value={{
|
|
118
107
|
configs: initialConfig,
|
|
119
|
-
loading,
|
|
120
108
|
error,
|
|
121
109
|
availableVersions,
|
|
122
110
|
packageID,
|
|
@@ -126,7 +114,7 @@ export const AppConfigProvider = ({
|
|
|
126
114
|
setPackageID
|
|
127
115
|
}}
|
|
128
116
|
>
|
|
129
|
-
{
|
|
117
|
+
{children}
|
|
130
118
|
</AppConfigContext.Provider>
|
|
131
119
|
)
|
|
132
120
|
}
|