Fix Capacitor dependencies - use built-in HTTP instead of separate plugin
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { Preferences } from '@capacitor/preferences';
|
||||
import { Http } from '@capacitor/http';
|
||||
|
||||
const BACKEND_BASE_URL = window.BACKEND_BASE_URL || 'https://api.example.com';
|
||||
|
||||
@@ -17,20 +16,19 @@ export async function syncApp(appId) {
|
||||
|
||||
const appData = JSON.parse(value);
|
||||
|
||||
const response = await Http.request({
|
||||
const response = await fetch(`${BACKEND_BASE_URL}/desktop/apps/sync`, {
|
||||
method: 'POST',
|
||||
url: `${BACKEND_BASE_URL}/desktop/apps/sync`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: appData,
|
||||
body: JSON.stringify(appData),
|
||||
});
|
||||
|
||||
if (response.status < 200 || response.status >= 300) {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Sync failed: ${response.status}`);
|
||||
}
|
||||
|
||||
return response.data;
|
||||
return response.json();
|
||||
}
|
||||
|
||||
export async function runOpencodeTask(appId, taskName, args = []) {
|
||||
|
||||
Reference in New Issue
Block a user