mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-29 08:49:17 +03:00
30 lines
761 B
JavaScript
30 lines
761 B
JavaScript
import { runQuery } from "~/node_common/data/utilities";
|
|
|
|
//NOTE(toast): allows for creation of mulitple codes and just
|
|
//passing the sid for the most recent verification session
|
|
export default async ({ email, pin, twitterToken, username, type }) => {
|
|
return await runQuery({
|
|
label: "CREATE_VERIFICATION",
|
|
queryFn: async (DB) => {
|
|
const query = await DB.insert({
|
|
email,
|
|
pin,
|
|
username,
|
|
twitterToken,
|
|
type,
|
|
})
|
|
.into("verifications")
|
|
.returning("*");
|
|
|
|
const index = query ? query.pop() : null;
|
|
return JSON.parse(JSON.stringify(index));
|
|
},
|
|
errorFn: async (e) => {
|
|
return {
|
|
error: true,
|
|
decorator: "CREATE_VERIFICATION",
|
|
};
|
|
},
|
|
});
|
|
};
|