-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Issue-1753] Fix bug when use @chainflip new version
- Loading branch information
dominhquang
committed
Sep 26, 2024
1 parent
0c4dd45
commit 23bc238
Showing
11 changed files
with
774 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,11 @@ | ||
import axios from 'axios'; | ||
import { getStaticContentByDevMode } from './storage'; | ||
import { fetchJson, fetchText } from '@subwallet/extension-base/utils'; | ||
import { staticData, StaticKey } from '@subwallet/extension-base/utils/staticData'; | ||
import { STATIC_DATA_DOMAIN } from 'constants/index'; | ||
|
||
export async function fetchStaticData<T>(slug: string, targetFile?: string, isJson = true) { | ||
export async function fetchStaticData<T>(slug: string, targetFile?: string) { | ||
const dataByDevModeStatus = getStaticContentByDevMode(); | ||
const fetchFile = targetFile || dataByDevModeStatus; | ||
const rs = await axios.get(`${STATIC_DATA_DOMAIN}/${slug}/${fetchFile}.json`); | ||
|
||
try { | ||
if (isJson) { | ||
return await fetchJson<T>(`https://static-data.subwallet.app/${slug}/${fetchFile}`); | ||
} else { | ||
return await fetchText<T>(`https://static-data.subwallet.app/${slug}/${fetchFile}`); | ||
} | ||
} catch (e) { | ||
console.log('error fetching static data', e); | ||
|
||
return staticData[slug as StaticKey] as T; | ||
} | ||
return rs.data as T; | ||
} |
Oops, something went wrong.