mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-24 17:44:50 +03:00
30 lines
540 B
JavaScript
30 lines
540 B
JavaScript
|
import { runQuery } from "~/node_common/data/utilities";
|
||
|
|
||
|
export default async ({ id }) => {
|
||
|
return await runQuery({
|
||
|
label: "GET_API_KEY",
|
||
|
queryFn: async (DB) => {
|
||
|
const query = await DB.select("*")
|
||
|
.from("keys")
|
||
|
.where({ id })
|
||
|
.first();
|
||
|
|
||
|
if (!query || query.error) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
if (query.id) {
|
||
|
return query;
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
},
|
||
|
errorFn: async (e) => {
|
||
|
return {
|
||
|
error: "GET_API_KEY",
|
||
|
source: e,
|
||
|
};
|
||
|
},
|
||
|
});
|
||
|
};
|