Skip to content

Commit

Permalink
Got rid of unused endpoint and function
Browse files Browse the repository at this point in the history
  • Loading branch information
overmode committed Jan 14, 2025
1 parent d788765 commit ee21bd4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 180 deletions.
46 changes: 0 additions & 46 deletions front/lib/swr/data_source_view_tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,49 +133,3 @@ export function useUpdateDataSourceViewTable(

return doUpdate;
}

export function useCreateDataSourceTable(
owner: LightWorkspaceType,
dataSourceView: DataSourceViewType
) {
const { mutateRegardlessOfQueryParams: mutateContentNodes } =
useDataSourceViewContentNodes({
owner,
dataSourceView,
disabled: true, // Needed just to mutate
});
const sendNotification = useSendNotification();

const doCreate = async (body: PostDataSourceTableRequestBody) => {
const tableUrl = `/api/w/${owner.sId}/spaces/${dataSourceView.spaceId}/data_sources/${dataSourceView.dataSource.sId}/tables`;
const res = await fetch(tableUrl, {
method: "POST",
body: JSON.stringify(body),
headers: {
"Content-Type": "application/json",
},
});
if (!res.ok) {
const errorData = await getErrorFromResponse(res);
sendNotification({
type: "error",
title: "Error creating table",
description: `Error: ${errorData.message}`,
});
return null;
} else {
void mutateContentNodes();

sendNotification({
type: "success",
title: "Table created",
description: "Table has been created",
});

const response: PostTableResponseBody = await res.json();
return response.table;
}
};

return doCreate;
}

This file was deleted.

0 comments on commit ee21bd4

Please sign in to comment.