mirror of
https://github.com/lemeow125/React-NotesApp.git
synced 2024-11-16 22:19:27 +08:00
Merge pull request #16 from lemeow125/hotfix/public_notes
Hotfix/public notes
This commit is contained in:
commit
1ccd93cef8
4 changed files with 5 additions and 12 deletions
|
@ -27,16 +27,9 @@ export function GetNotes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetPublicNotes() {
|
export function GetPublicNotes() {
|
||||||
const token = JSON.parse(localStorage.getItem("token") || "{}");
|
return instance.get("/api/v1/public_notes/").then((response) => {
|
||||||
return instance
|
return response.data;
|
||||||
.get("/api/v1/public_notes/", {
|
});
|
||||||
headers: {
|
|
||||||
Authorization: "Token " + token,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((response) => {
|
|
||||||
return response.data;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetNote(id: number) {
|
export function GetNote(id: number) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Button } from "@mui/material";
|
||||||
import { useQuery } from "react-query";
|
import { useQuery } from "react-query";
|
||||||
import { GetPublicNotes } from "../Api/Api";
|
import { GetPublicNotes } from "../Api/Api";
|
||||||
import { NoteProps } from "../../Interfaces/Interfaces";
|
import { NoteProps } from "../../Interfaces/Interfaces";
|
||||||
import PublicNote from "../PublicNote/Note";
|
import PublicNote from "../PublicNote/PublicNote";
|
||||||
|
|
||||||
export default function PublicNotes() {
|
export default function PublicNotes() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
|
@ -3,7 +3,7 @@ import { useState } from "react";
|
||||||
import styles from "../../styles";
|
import styles from "../../styles";
|
||||||
import { Switch } from "@mui/material";
|
import { Switch } from "@mui/material";
|
||||||
import Notes from "../Notes/Notes";
|
import Notes from "../Notes/Notes";
|
||||||
import PublicNotes from "../PublicNotes/Notes";
|
import PublicNotes from "../PublicNotes/PublicNotes";
|
||||||
|
|
||||||
export default function ViewToggle() {
|
export default function ViewToggle() {
|
||||||
const [switchLabel, setLabel] = useState("Viewing public notes");
|
const [switchLabel, setLabel] = useState("Viewing public notes");
|
||||||
|
|
Loading…
Reference in a new issue