mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-02-15 16:36:01 -05:00
* upgraded storybook dependencies * upgraded web dependencies * updated timezone selector * upgrade chakra in metamaps * upgraded react-dnd in metamaps * upgraded framer-motion * fixed types in metamaps * upgraded eslint * upgraded lerna, husky and graphql * upgraded node version * removed metamaps package * fixed all eslint issues * ran yarn format to prettier format all files * updated lint-staged & husky scripts * add executable perms to pre-push scripts * updated yarn.lock * fixed eslint and moved chakra icons to ds * fixed emotion errors * removed extra useContext * update yarn.lock * upgraded more packages * removed unnecessary .huskyrc.json * lint fix
31 lines
647 B
TypeScript
31 lines
647 B
TypeScript
import gql from 'fake-tag';
|
|
|
|
import { GetGuildsQuery, GetGuildsQueryVariables } from './autogen/types';
|
|
import { client } from './client';
|
|
import { GuildFragment } from './fragments';
|
|
|
|
const guildsQuery = gql`
|
|
query GetGuilds($limit: Int) {
|
|
guild(where: { status: { _eq: ACTIVE } }, limit: $limit) {
|
|
...GuildFragment
|
|
}
|
|
}
|
|
${GuildFragment}
|
|
`;
|
|
|
|
export const getGuilds = async (limit = 50) => {
|
|
const { data, error } = await client
|
|
.query<GetGuildsQuery, GetGuildsQueryVariables>(guildsQuery, { limit })
|
|
.toPromise();
|
|
|
|
if (!data) {
|
|
if (error) {
|
|
throw error;
|
|
}
|
|
|
|
return [];
|
|
}
|
|
|
|
return data.guild;
|
|
};
|