Update API getNotes function to return a SearchResult
authorAdam Dullage <redacted>
Thu, 2 May 2024 12:19:27 +0000 (13:19 +0100)
committerAdam Dullage <redacted>
Thu, 2 May 2024 12:19:27 +0000 (13:19 +0100)
client/api.js

index f882f24bf40faa2bf12eb30bfc53627273f7a46a..196d4c4f85629c28185643b4d6009d6c5649e471 100644 (file)
@@ -1,6 +1,7 @@
 import * as constants from "./constants.js";
 
-import { Note } from "./classes.js";
+import { Note, SearchResult } from "./classes.js";
+
 import axios from "axios";
 import { getStoredToken } from "./tokenStorage.js";
 import router from "./router.js";
@@ -73,7 +74,7 @@ export async function getNotes(term, sort, order, limit) {
       },
     });
     return response.data.map(
-      (note) => new Note(note.title, note.lastModified, note.content),
+      (note) => new SearchResult(note),
     );
   } catch (response) {
     return Promise.reject(response);
git clone https://git.99rst.org/PROJECT