Download spectrum/api/queries/thread/rootThread.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 410 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/spectrum/api/queries/thread/rootThread.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/spectrum/api/queries/thread/rootThread.js
-
curl -L -o rootThread.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/spectrum/api/queries/thread/rootThread.js
410 Bytes
| // @flow | |
| import type { GraphQLContext } from '../../'; | |
| import { canViewThread } from '../../utils/permissions'; | |
| export default async ( | |
| _: any, | |
| { id }: { id: string }, | |
| { loaders, user }: GraphQLContext | |
| ) => { | |
| if (!(await canViewThread(user ? user.id : 'undefined', id, loaders))) { | |
| return null; | |
| } | |
| const thread = await loaders.thread.load(id); | |
| if (!thread) return null; | |
| return thread; | |
| }; | |