Polished api and moved from axios to fetch

This commit is contained in:
keannu125 2023-02-25 21:27:26 +08:00
parent d96c26bc1a
commit 044f45e038
2 changed files with 7 additions and 3 deletions

View file

@ -1,7 +1,9 @@
import axios from "axios";
import { get } from "http";
export function GetNotes() {
return fetch("http://localhost:8000/api/v1/notes/").then((res) => {
const result = res.json();
console.log();
return result;
console.log(res);
return res.json();
});
}

View file

@ -2,6 +2,7 @@ import * as React from "react";
import styles from "../../styles";
import { Button } from "@mui/material";
import axios from "axios";
import { useQueryClient } from "react-query";
export interface props {
title: string;
@ -10,6 +11,7 @@ export interface props {
date_created: string;
}
export default function Note(props: props) {
const queryClient = useQueryClient();
return (
<div style={styles.flex_column}>
<div style={styles.note}>