Skip to content

Commit fdc139f

Browse files
committed
fix: update API response handling in getDefaultCanvas and log default canvas data
- Modified the getDefaultCanvas function to return result.data instead of the entire result object, ensuring correct data retrieval. - Added a console log in SettingsDialog to output the fetched default canvas data for debugging purposes.
1 parent 9bb699c commit fdc139f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/frontend/src/api/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const api = {
119119
getDefaultCanvas: async (): Promise<CanvasData> => {
120120
try {
121121
const result = await fetchApi('/api/templates/default');
122-
return result;
122+
return result.data;
123123
} catch (error) {
124124
throw error;
125125
}

src/frontend/src/ui/SettingsDialog.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ const SettingsDialog: React.FC<SettingsDialogProps> = ({
5050

5151
// Use the API function from hooks.ts to fetch the default canvas
5252
const defaultCanvasData = await api.getDefaultCanvas();
53-
console.log("Default canvas data:", defaultCanvasData);
53+
54+
console.debug("Default canvas data:", defaultCanvasData);
5455

5556
// Normalize the canvas data before updating the scene
5657
const normalizedData = normalizeCanvasData(defaultCanvasData);
5758

5859
// Update the canvas with the normalized default data
5960
excalidrawAPI.updateScene(normalizedData);
6061

61-
console.log("Canvas reset to default successfully");
62+
console.debug("Canvas reset to default successfully");
6263

6364
// Close the dialog after successful restore
6465
handleClose();

0 commit comments

Comments
 (0)