Spaces:
Sleeping
Sleeping
techedstudios commited on
Commit ·
d9d1d48
1
Parent(s): 6105a3f
Fix restore cloud button auth token issue
Browse files- src/App.tsx +5 -4
src/App.tsx
CHANGED
|
@@ -2476,13 +2476,14 @@ function FileManagerComponent({ serverId }: { serverId: string }) {
|
|
| 2476 |
onClick={async () => {
|
| 2477 |
if (!confirm('This will download your latest backup from HF datasets. Continue?')) return;
|
| 2478 |
try {
|
| 2479 |
-
const
|
| 2480 |
-
|
| 2481 |
-
method: 'POST',
|
| 2482 |
-
headers: { 'Authorization': `Bearer ${token}` }
|
| 2483 |
});
|
| 2484 |
if (res.ok) {
|
| 2485 |
alert('Restore started! Check the console or cloud sync tab for progress. Refresh files soon.');
|
|
|
|
|
|
|
|
|
|
| 2486 |
}
|
| 2487 |
} catch (e) {
|
| 2488 |
alert('Error starting restore');
|
|
|
|
| 2476 |
onClick={async () => {
|
| 2477 |
if (!confirm('This will download your latest backup from HF datasets. Continue?')) return;
|
| 2478 |
try {
|
| 2479 |
+
const res = await authFetch(`${API_BASE}/api/servers/${serverId}/restore`, {
|
| 2480 |
+
method: 'POST'
|
|
|
|
|
|
|
| 2481 |
});
|
| 2482 |
if (res.ok) {
|
| 2483 |
alert('Restore started! Check the console or cloud sync tab for progress. Refresh files soon.');
|
| 2484 |
+
} else {
|
| 2485 |
+
const data = await res.json();
|
| 2486 |
+
alert('Failed: ' + (data.error || 'Unknown error'));
|
| 2487 |
}
|
| 2488 |
} catch (e) {
|
| 2489 |
alert('Error starting restore');
|