This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ApolloClient, split, HttpLink, InMemoryCache } from '@apollo/client'; | |
| import { getMainDefinition } from '@apollo/client/utilities'; | |
| import { WebSocketLink } from '@apollo/link-ws'; | |
| import Introspection from './introspection-result.json'; | |
| const wsLink = new WebSocketLink({ | |
| uri: `ws://localhost:5000/graphql`, | |
| options: { reconnect: true } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| overwrite: true | |
| schema: "http://localhost:5000/graphql" | |
| documents: | |
| - components/**/*.tsx | |
| - graphql/queries/*.ts | |
| generates: | |
| graphql/generated.ts: | |
| plugins: | |
| - typescript | |
| - typescript-operations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { View } from 'react-native'; | |
| import { AuthNavProps } from '../navigation/types/AuthStackParams'; | |
| export const LoginScreen = ({}: AuthNavProps<'Conversation'>) => { | |
| return ( | |
| <View /> | |
| ); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { View } from 'react-native'; | |
| import { MainNavProps } from '../navigation/types/MainStackParams'; | |
| export const ConversationScreen = ({}: MainNavProps<'Conversation'>) => { | |
| return ( | |
| <View /> | |
| ); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { createStackNavigator } from '@react-navigation/stack'; | |
| import { MainStackParams } from './types/MainStackParams'; | |
| import { ConversationScreen } from '../screens/ConversationScreen'; | |
| const MainStack = createStackNavigator<MainStackParams>(); | |
| export const MainStackScreens: React.FC = () => ( | |
| <MainStack.Navigator | |
| initialRouteName="Conversation" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { createStackNavigator } from '@react-navigation/stack'; | |
| import { AuthStackParams } from './types/AuthStackParams'; | |
| import { LoginScreen } from '../screens/LoginScreen'; | |
| const AuthStack = createStackNavigator<AuthStackParams>(); | |
| export const AuthStackScreens: React.FC = () => ( | |
| <AuthStack.Navigator initialRouteName="Login"> | |
| <AuthStack.Screen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { StackNavigationProp } from '@react-navigation/stack'; | |
| import { RouteProp } from '@react-navigation/native'; | |
| export type MainStackParams = { | |
| Conversation: undefined; | |
| }; | |
| export type MainNavProps<T extends keyof MainStackParams> = { | |
| navigation: StackNavigationProp<MainStackParams, T>; | |
| route: RouteProp<MainStackParams, T>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { StackNavigationProp } from '@react-navigation/stack'; | |
| import { RouteProp } from '@react-navigation/native'; | |
| export type AuthStackParams = { | |
| Login: undefined; | |
| }; | |
| export type AuthNavProps<T extends keyof AuthStackParams> = { | |
| navigation: StackNavigationProp<AuthStackParams, T>; | |
| route: RouteProp<AuthStackParams, T>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { SchemaDirectiveVisitor } from 'graphql-tools'; | |
| import { gql, AuthenticationError } from 'apollo-server'; | |
| import { GraphQLField, defaultFieldResolver } from 'graphql'; | |
| import AccessTokenModel from '../models/AccessTokenModel'; | |
| import { ResolverContext } from '../types'; | |
| class AuthDirective extends SchemaDirectiveVisitor { | |
| visitFieldDefinition(field: GraphQLField<any, any>) { | |
| const { resolve = defaultFieldResolver } = field; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { gql } from 'apollo-server-express'; | |
| import { PubSub } from 'apollo-server'; | |
| import { QueryResolvers, MessagesMutationResolvers } from '../generated/graphql'; | |
| import MessageModel from '../models/MessageModel'; | |
| const NEW_MESSAGE_EVENT = 'NEW_MESSAGE'; | |
| const pubsub = new PubSub(); | |
| const typeDefs = gql` |