Merge branch 'main' into 404

This commit is contained in:
Esther Lizardo
2023-02-13 21:47:08 +00:00
committed by GitHub
9 changed files with 54 additions and 32 deletions

View File

@ -2,22 +2,18 @@ import toast from "react-hot-toast";
export const updateUser = async (user: any) => {
if (!user) return;
toast
.promise(
fetch("/api/users", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(user),
}),
{
loading: "Saving Changes...",
success: `Saved!`,
error: "Changes could not save user :/",
}
)
.then(() => {
// location.reload();
});
toast.promise(
fetch("/api/users", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(user),
}),
{
loading: "Saving Changes...",
success: `Saved!`,
error: "Changes could not save user :/",
}
);
};

View File

@ -12,7 +12,7 @@ export const getDocument = async (
if (!documentId) Promise.reject("No documentId");
if (!req || !res) Promise.reject("No res or req");
const document: PrismaDocument = await prisma.document.findFirstOrThrow({
const document: PrismaDocument = await prisma.document.findFirst({
where: {
id: documentId,
userId: user.id,

View File

@ -35,6 +35,7 @@ export function Button(props: any) {
) : (
<button
id={props.id}
type="button"
className={classNames(
baseStyles,
color === "primary" ? primaryStyles : secondaryStyles,