-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/connect-foundation/2019-17…
… into feature-140/feed_realtime develop과 머지 - write feed 후 pubsub으로 통지받도록 변경 - 캐시 전략 notifyOnNetworkStatusChange: true 로 설정
- Loading branch information
Showing
32 changed files
with
299 additions
and
301 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
client/src/__test__/composition/feed/WritingFeed/WritingFeed.test.tsx
This file was deleted.
Oops, something went wrong.
80 changes: 0 additions & 80 deletions
80
client/src/__test__/composition/feed/WritingFeed/__snapshots__/WritingFeed.test.tsx.snap
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { ApolloClient } from 'apollo-client'; | ||
import { InMemoryCache } from 'apollo-boost'; | ||
import { persistCache } from 'apollo-cache-persist'; | ||
import { ApolloProvider } from '@apollo/react-hooks'; | ||
import link from './Link'; | ||
import { resolvers } from './resolvers'; | ||
import { typeDefs } from './typeDefs'; | ||
|
||
interface IProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
const Apollo: React.FC = ({ children }: IProps) => { | ||
const [client, setClient] = useState<ApolloClient<any>>(); | ||
useEffect(() => { | ||
const cache = new InMemoryCache(); | ||
|
||
const client = new ApolloClient({ | ||
cache, | ||
link, | ||
typeDefs, | ||
resolvers | ||
}); | ||
|
||
persistCache({ | ||
cache, | ||
storage: window.localStorage | ||
}).then(() => { | ||
setClient(client); | ||
}); | ||
}, []); | ||
if (client === undefined) return <div>Loading...</div>; | ||
return <ApolloProvider client={client}>{children}</ApolloProvider>; | ||
}; | ||
|
||
export default Apollo; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export const typeDefs = gql` | ||
extend type Query { | ||
login: void | ||
logout: void | ||
} | ||
extend type Mutation { | ||
enrollWritingFeed: void | ||
} | ||
`; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export const getWritingFeedData = gql` | ||
{ | ||
writingFeedContent @client | ||
} | ||
`; | ||
|
||
export const enrollWritingFeedData = gql` | ||
mutation enrollWritingFeed($content: String!) { | ||
enrollWritingFeed(content: $content) @client | ||
} | ||
`; |
This file contains 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
This file contains 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
17 changes: 17 additions & 0 deletions
17
client/src/composition/Feed/WritingFeed/WritingFeed.query.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { gql } from 'apollo-boost'; | ||
|
||
export const ENROLL_FEED_MUTATION = gql` | ||
mutation enrollFeed($content: String!, $files: [Upload]) { | ||
enrollFeed(content: $content, files: $files) | ||
} | ||
`; | ||
|
||
export const ME_QUERY = gql` | ||
query me { | ||
me { | ||
thumbnail | ||
nickname | ||
} | ||
} | ||
`; |
Oops, something went wrong.