Skip to content

Commit 78a3fde

Browse files
[OFF-784]: Use xas-info to check if we are connected to the server - LTS (#380)
2 parents 357f0de + b65ecd0 commit 78a3fde

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

packages/jsActions/nanoflow-actions-native/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
- We've fixed isConnectedToServer succeeding without internet on offline apps when service worker is enabled.
11+
912
## [5.1.3] Nanoflow Commons - 2025-9-24
1013
### Fixed
1114

packages/jsActions/nanoflow-actions-native/src/client/IsConnectedToServer.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@
1515
export async function IsConnectedToServer(): Promise<boolean> {
1616
// BEGIN USER CODE
1717
try {
18-
const response = await fetch(mx.remoteUrl);
18+
const headers = new Headers();
19+
headers.append("Content-Type", "application/json");
20+
const body = JSON.stringify({ action: "info" });
21+
22+
const requestOptions = {
23+
method: "POST",
24+
headers,
25+
body
26+
};
27+
28+
// mx.remoteUrl always has / at the end, therefore we don't add it.
29+
const response = await fetch(`${mx.remoteUrl}xas/`, requestOptions);
1930
return response.ok;
2031
} catch (err) {
2132
console.error(err);

0 commit comments

Comments
 (0)