mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-29 08:49:17 +03:00
27 lines
598 B
JavaScript
27 lines
598 B
JavaScript
import * as Logging from "~/common/logging";
|
|
|
|
import { runQuery } from "~/node_common/data/utilities";
|
|
|
|
export default async ({ userId }) => {
|
|
return await runQuery({
|
|
label: "GET_API_KEYS_BY_USER_ID",
|
|
queryFn: async (DB) => {
|
|
const query = await DB.select("*").from("keys").where({ ownerId: userId });
|
|
|
|
if (!query || query.error) {
|
|
return [];
|
|
}
|
|
|
|
return JSON.parse(JSON.stringify(query));
|
|
},
|
|
errorFn: async (e) => {
|
|
Logging.error({
|
|
error: true,
|
|
decorator: "GET_API_KEYS_BY_USER_ID",
|
|
});
|
|
|
|
return [];
|
|
},
|
|
});
|
|
};
|