diff --git a/src/Components/Api/Api.tsx b/src/Components/Api/Api.tsx index d93144c..cb3e0b2 100644 --- a/src/Components/Api/Api.tsx +++ b/src/Components/Api/Api.tsx @@ -10,7 +10,7 @@ import { // Note APIs const instance = axios.create({ - baseURL: "https://keannu126.pythonanywhere.com", + baseURL: "https://keannu125.pythonanywhere.com", }); export function GetNotes() { @@ -26,6 +26,19 @@ export function GetNotes() { }); } +export function GetPublicNotes() { + const token = JSON.parse(localStorage.getItem("token") || "{}"); + return instance + .get("/api/v1/public_notes/", { + headers: { + Authorization: "Token " + token, + }, + }) + .then((response) => { + return response.data; + }); +} + export function GetNote(id: number) { const token = JSON.parse(localStorage.getItem("token") || "{}"); return instance diff --git a/src/Components/Note/Note.tsx b/src/Components/Note/Note.tsx index 59003e7..b382b84 100644 --- a/src/Components/Note/Note.tsx +++ b/src/Components/Note/Note.tsx @@ -13,6 +13,7 @@ export default function Note(props: NoteProps) { mutationFn: DeleteNote, onSuccess: () => { queryClient.invalidateQueries("notes"); + queryClient.invalidateQueries("public_notes"); }, }); return ( @@ -30,6 +31,7 @@ export default function Note(props: NoteProps) {

Timestamp: {String(props.date_created)}

+

Public: {props.public ? "Yes" : "No"}