mirror of
https://github.com/lemeow125/React-NotesApp.git
synced 2024-11-17 06:29:28 +08:00
Polished and fixed Edit note page not displaying properly while loading
This commit is contained in:
parent
eff9ebcbfa
commit
33ea3f8080
1 changed files with 7 additions and 6 deletions
|
@ -3,9 +3,8 @@ import { Button } from "@mui/material";
|
|||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useEffect, useState } from "react";
|
||||
import Header from "../../Components/Header/Header";
|
||||
import { AddNote, GetNote, UpdateNote } from "../../Components/Api/Api";
|
||||
import { GetNote, UpdateNote } from "../../Components/Api/Api";
|
||||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
import { NoteProps } from "../../Interfaces/Interfaces";
|
||||
|
||||
export interface input {
|
||||
e: React.ChangeEvent;
|
||||
|
@ -34,7 +33,7 @@ export default function ViewNote() {
|
|||
});
|
||||
useEffect(() => {
|
||||
setNote(data);
|
||||
}, []);
|
||||
}, [data]);
|
||||
if (error) {
|
||||
return (
|
||||
<div style={styles.background}>
|
||||
|
@ -47,8 +46,10 @@ export default function ViewNote() {
|
|||
}
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div style={styles.note}>
|
||||
<p style={styles.text_medium}>Loading Note...</p>
|
||||
<div style={styles.background}>
|
||||
<div style={styles.note}>
|
||||
<p style={styles.text_medium}>Loading Note...</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -112,4 +113,4 @@ export default function ViewNote() {
|
|||
);
|
||||
}
|
||||
return <div>heh</div>;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue