mirror of
https://github.com/lemeow125/React-NotesApp.git
synced 2024-11-17 06:29:28 +08:00
Polished api and moved from axios to fetch
This commit is contained in:
parent
d96c26bc1a
commit
044f45e038
2 changed files with 7 additions and 3 deletions
|
@ -1,7 +1,9 @@
|
||||||
|
import axios from "axios";
|
||||||
|
import { get } from "http";
|
||||||
|
|
||||||
export function GetNotes() {
|
export function GetNotes() {
|
||||||
return fetch("http://localhost:8000/api/v1/notes/").then((res) => {
|
return fetch("http://localhost:8000/api/v1/notes/").then((res) => {
|
||||||
const result = res.json();
|
console.log(res);
|
||||||
console.log();
|
return res.json();
|
||||||
return result;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import * as React from "react";
|
||||||
import styles from "../../styles";
|
import styles from "../../styles";
|
||||||
import { Button } from "@mui/material";
|
import { Button } from "@mui/material";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import { useQueryClient } from "react-query";
|
||||||
|
|
||||||
export interface props {
|
export interface props {
|
||||||
title: string;
|
title: string;
|
||||||
|
@ -10,6 +11,7 @@ export interface props {
|
||||||
date_created: string;
|
date_created: string;
|
||||||
}
|
}
|
||||||
export default function Note(props: props) {
|
export default function Note(props: props) {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
return (
|
return (
|
||||||
<div style={styles.flex_column}>
|
<div style={styles.flex_column}>
|
||||||
<div style={styles.note}>
|
<div style={styles.note}>
|
||||||
|
|
Loading…
Reference in a new issue