slate/node_common/data/methods/update-verification.js
2021-06-08 15:53:30 -07:00

26 lines
637 B
JavaScript

import { runQuery } from "~/node_common/data/utilities";
export default async ({ sid, isVerified, passwordChanged }) => {
return await runQuery({
label: "UPDATE_VERIFICATION",
queryFn: async (DB) => {
const response = await DB.from("verifications")
.where("sid", sid)
.update({
isVerified,
passwordChanged,
})
.returning("*");
const index = response ? response.pop() : null;
return JSON.parse(JSON.stringify(index));
},
errorFn: async (e) => {
return {
error: true,
decorator: "UPDATE_VERIFICATION",
};
},
});
};