mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-29 08:49:17 +03:00
27 lines
577 B
JavaScript
27 lines
577 B
JavaScript
|
import { runQuery } from "~/node_common/data/utilities";
|
||
|
|
||
|
export default async ({ token }) => {
|
||
|
return await runQuery({
|
||
|
label: "GET_TWITTER_TOKEN",
|
||
|
queryFn: async (DB) => {
|
||
|
const query = await DB.select("*").from("twitterTokens").where({ token }).first();
|
||
|
|
||
|
if (!query || query.error) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
if (query.token) {
|
||
|
return JSON.parse(JSON.stringify(query));
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
},
|
||
|
errorFn: async (e) => {
|
||
|
return {
|
||
|
error: true,
|
||
|
decorator: "GET_TWITTER_TOKEN",
|
||
|
};
|
||
|
},
|
||
|
});
|
||
|
};
|