mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-11-22 23:46:10 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11d40ce5f2 | ||
|
|
4a1d4d5a50 | ||
|
|
02517a9eb0 |
@@ -125,7 +125,6 @@ RCT_EXPORT_MODULE(RCTPushy);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return [RCTPushy binaryBundleURL];
|
return [RCTPushy binaryBundleURL];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update",
|
"name": "react-native-update",
|
||||||
"version": "10.30.0",
|
"version": "10.30.3",
|
||||||
"description": "react-native hot update",
|
"description": "react-native hot update",
|
||||||
"main": "src/index",
|
"main": "src/index",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
17
src/utils.ts
17
src/utils.ts
@@ -108,10 +108,21 @@ export const assertWeb = () => {
|
|||||||
export const enhancedFetch = async (
|
export const enhancedFetch = async (
|
||||||
url: string,
|
url: string,
|
||||||
params: Parameters<typeof fetch>[1],
|
params: Parameters<typeof fetch>[1],
|
||||||
) => {
|
isRetry = false,
|
||||||
return fetch(url, params).catch(e => {
|
): Promise<Response> => {
|
||||||
|
return fetch(url, params)
|
||||||
|
.then(r => {
|
||||||
|
if (r.ok) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
throw new Error(`${r.status} ${r.statusText}`);
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
log('fetch error', url, e);
|
log('fetch error', url, e);
|
||||||
|
if (isRetry) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
log('trying fallback to http');
|
log('trying fallback to http');
|
||||||
return fetch(url.replace('https', 'http'), params);
|
return enhancedFetch(url.replace('https', 'http'), params, true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user