routing fix
This commit is contained in:
parent
6ee055b691
commit
e0a8e503b9
2 changed files with 10 additions and 11 deletions
|
|
@ -24,7 +24,7 @@ const getFolderTree = async () => {
|
|||
const encryptionKey = useAuthStore.getState().encryptionKey;
|
||||
if (!encryptionKey) throw new Error("Not authenticated");
|
||||
|
||||
const { data, error } = await client.GET("/api/folders/tree", {});
|
||||
const { data, error } = await client.GET("/folders/tree", {});
|
||||
|
||||
const newData = data as unknown as FolderTreeResponse;
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ const getFolderTree = async () => {
|
|||
const updateFolder = async (id: number, folder: FolderUpdate) => {
|
||||
console.log(`Updating folder ${id} with:`, folder);
|
||||
try {
|
||||
const response = await client.PATCH("/api/folders/{folder_id}", {
|
||||
const response = await client.PATCH("/folders/{folder_id}", {
|
||||
params: { path: { folder_id: id } },
|
||||
body: folder,
|
||||
});
|
||||
|
|
@ -50,11 +50,10 @@ const updateFolder = async (id: number, folder: FolderUpdate) => {
|
|||
|
||||
export const folderApi = {
|
||||
tree: () => getFolderTree(),
|
||||
list: () => client.GET("/api/folders/", {}),
|
||||
create: (folder: FolderCreate) =>
|
||||
client.POST("/api/folders/", { body: folder }),
|
||||
list: () => client.GET("/folders/", {}),
|
||||
create: (folder: FolderCreate) => client.POST("/folders/", { body: folder }),
|
||||
delete: (id: number) =>
|
||||
client.DELETE("/api/folders/{folder_id}", {
|
||||
client.DELETE("/folders/{folder_id}", {
|
||||
params: { path: { folder_id: id } },
|
||||
}),
|
||||
update: (id: number, updateData: FolderUpdate) =>
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ const createNote = async (note: NoteCreate) => {
|
|||
};
|
||||
|
||||
console.log(encryptedNote);
|
||||
return client.POST(`/api/notes/`, { body: encryptedNote });
|
||||
return client.POST(`/notes/`, { body: encryptedNote });
|
||||
};
|
||||
const fetchNotes = async () => {
|
||||
const encryptionKey = useAuthStore.getState().encryptionKey;
|
||||
if (!encryptionKey) throw new Error("Not authenticated");
|
||||
|
||||
const { data, error } = await client.GET(`/api/notes/`);
|
||||
const { data, error } = await client.GET(`/notes/`);
|
||||
|
||||
if (error) {
|
||||
throw new Error(error);
|
||||
|
|
@ -74,7 +74,7 @@ const updateNote = async (id: number, note: Partial<NoteRead>) => {
|
|||
encryptedNote.folderId = note.folderId;
|
||||
}
|
||||
|
||||
const { data, error } = await client.PATCH(`/api/notes/{note_id}`, {
|
||||
const { data, error } = await client.PATCH(`/notes/{note_id}`, {
|
||||
body: encryptedNote,
|
||||
params: {
|
||||
path: {
|
||||
|
|
@ -94,7 +94,7 @@ const updateNote = async (id: number, note: Partial<NoteRead>) => {
|
|||
export const notesApi = {
|
||||
list: () => fetchNotes(),
|
||||
get: (id: number) =>
|
||||
client.GET(`/api/notes/{note_id}`, {
|
||||
client.GET(`/notes/{note_id}`, {
|
||||
params: {
|
||||
path: {
|
||||
note_id: id,
|
||||
|
|
@ -104,7 +104,7 @@ export const notesApi = {
|
|||
create: (note: NoteCreate) => createNote(note),
|
||||
update: (id: number, note: Partial<NoteRead>) => updateNote(id, note),
|
||||
delete: (id: number) =>
|
||||
client.DELETE(`/api/notes/{note_id}`, {
|
||||
client.DELETE(`/notes/{note_id}`, {
|
||||
params: {
|
||||
path: {
|
||||
note_id: id,
|
||||
|
|
|
|||
Loading…
Reference in a new issue