📑 todods
This commit is contained in:
@@ -86,6 +86,7 @@ export default function TopNavigation() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// todo encapsulate
|
||||||
fetch("/api/users/me").then((res) => {
|
fetch("/api/users/me").then((res) => {
|
||||||
res.json().then((j) => {
|
res.json().then((j) => {
|
||||||
setUser(j);
|
setUser(j);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ export default function Setttings() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// todo encapsulate
|
||||||
fetch("/api/users/me").then((res) => {
|
fetch("/api/users/me").then((res) => {
|
||||||
res.json().then((j) => {
|
res.json().then((j) => {
|
||||||
setUser(j);
|
setUser(j);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export default function Signup(props: { source: string }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const signUp: SubmitHandler<FormValues> = async (data) => {
|
const signUp: SubmitHandler<FormValues> = async (data) => {
|
||||||
|
// todo encapsulate
|
||||||
const res = await toast
|
const res = await toast
|
||||||
.promise(
|
.promise(
|
||||||
fetch("/api/auth/signup", {
|
fetch("/api/auth/signup", {
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {
|
|||||||
|
|
||||||
const getDocuments = async () => {
|
const getDocuments = async () => {
|
||||||
if (!documents.length) setLoading(true);
|
if (!documents.length) setLoading(true);
|
||||||
|
// todo encapsulate
|
||||||
fetch("/api/documents", {
|
fetch("/api/documents", {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -354,6 +355,7 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {
|
|||||||
const removedItem: any =
|
const removedItem: any =
|
||||||
documentsWithoutIndex.splice(index, 1);
|
documentsWithoutIndex.splice(index, 1);
|
||||||
setDocuments(documentsWithoutIndex);
|
setDocuments(documentsWithoutIndex);
|
||||||
|
// todo encapsulate
|
||||||
fetch(`/api/documents/${document.id}`, {
|
fetch(`/api/documents/${document.id}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -383,6 +383,7 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// todo encapsulate
|
||||||
async function deleteRecipient(recipient: any) {
|
async function deleteRecipient(recipient: any) {
|
||||||
if (!recipient.id) {
|
if (!recipient.id) {
|
||||||
return;
|
return;
|
||||||
@@ -413,6 +414,7 @@ async function deleteRecipient(recipient: any) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo encapsulate
|
||||||
async function upsertRecipient(recipient: any): Promise<any> {
|
async function upsertRecipient(recipient: any): Promise<any> {
|
||||||
try {
|
try {
|
||||||
const created = await toast.promise(
|
const created = await toast.promise(
|
||||||
@@ -466,6 +468,7 @@ export async function getServerSideProps(context: any) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo encapsulate
|
||||||
async function send(document: any, resendTo: number[] = []) {
|
async function send(document: any, resendTo: number[] = []) {
|
||||||
if (!document || !document.id) return;
|
if (!document || !document.id) return;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user