mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 23:44:22 +00:00
Refactor API endpoints to include "_op" prefix for file and workspace operations
This commit is contained in:
@@ -47,7 +47,7 @@ export const lookupFileByName = async (
|
|||||||
const response = await apiCall(
|
const response = await apiCall(
|
||||||
`${API_BASE_URL}/workspaces/${encodeURIComponent(
|
`${API_BASE_URL}/workspaces/${encodeURIComponent(
|
||||||
workspaceName
|
workspaceName
|
||||||
)}/files/lookup?filename=${encodeURIComponent(filename)}`
|
)}/files/_op/lookup?filename=${encodeURIComponent(filename)}`
|
||||||
);
|
);
|
||||||
const data: unknown = await response.json();
|
const data: unknown = await response.json();
|
||||||
if (!isLookupResponse(data)) {
|
if (!isLookupResponse(data)) {
|
||||||
@@ -135,7 +135,9 @@ export const getLastOpenedFile = async (
|
|||||||
workspaceName: string
|
workspaceName: string
|
||||||
): Promise<string> => {
|
): Promise<string> => {
|
||||||
const response = await apiCall(
|
const response = await apiCall(
|
||||||
`${API_BASE_URL}/workspaces/${encodeURIComponent(workspaceName)}/files/last`
|
`${API_BASE_URL}/workspaces/${encodeURIComponent(
|
||||||
|
workspaceName
|
||||||
|
)}/files/_op/last`
|
||||||
);
|
);
|
||||||
const data: unknown = await response.json();
|
const data: unknown = await response.json();
|
||||||
if (
|
if (
|
||||||
@@ -161,7 +163,7 @@ export const updateLastOpenedFile = async (
|
|||||||
await apiCall(
|
await apiCall(
|
||||||
`${API_BASE_URL}/workspaces/${encodeURIComponent(
|
`${API_BASE_URL}/workspaces/${encodeURIComponent(
|
||||||
workspaceName
|
workspaceName
|
||||||
)}/files/last`,
|
)}/files/_op/last`,
|
||||||
{
|
{
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export const deleteWorkspace = async (
|
|||||||
* @throws {Error} If the API call fails or returns an invalid response
|
* @throws {Error} If the API call fails or returns an invalid response
|
||||||
*/
|
*/
|
||||||
export const getLastWorkspaceName = async (): Promise<string> => {
|
export const getLastWorkspaceName = async (): Promise<string> => {
|
||||||
const response = await apiCall(`${API_BASE_URL}/workspaces/last`);
|
const response = await apiCall(`${API_BASE_URL}/workspaces/_op/last`);
|
||||||
const data: unknown = await response.json();
|
const data: unknown = await response.json();
|
||||||
if (
|
if (
|
||||||
typeof data !== 'object' ||
|
typeof data !== 'object' ||
|
||||||
@@ -139,7 +139,7 @@ export const getLastWorkspaceName = async (): Promise<string> => {
|
|||||||
* @throws {Error} If the API call fails or returns an invalid response
|
* @throws {Error} If the API call fails or returns an invalid response
|
||||||
*/
|
*/
|
||||||
export const updateLastWorkspaceName = async (workspaceName: string) => {
|
export const updateLastWorkspaceName = async (workspaceName: string) => {
|
||||||
const response = await apiCall(`${API_BASE_URL}/workspaces/last`, {
|
const response = await apiCall(`${API_BASE_URL}/workspaces/_op/last`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|||||||
Reference in New Issue
Block a user