File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import Avatar from './Avatar'
66import { useMutation } from '@apollo/client'
77import { ADD_POST , ADD_SUBREDDIT } from '../graphql/mutations'
88import client from '../apollo-client'
9- import { GET_SUBREDDIT_BY_TOPIC } from '../graphql/queries'
9+ import { GET_ALL_POSTS , GET_SUBREDDIT_BY_TOPIC } from '../graphql/queries'
1010import toast from 'react-hot-toast'
1111
1212type FormData = {
@@ -18,7 +18,9 @@ type FormData = {
1818
1919function PostBox ( ) {
2020 const { data : session } = useSession ( )
21- const [ addPost ] = useMutation ( ADD_POST )
21+ const [ addPost ] = useMutation ( ADD_POST , {
22+ refetchQueries : [ GET_ALL_POSTS , 'getPostList' ]
23+ } )
2224 const [ addSubreddit ] = useMutation ( ADD_SUBREDDIT )
2325
2426 const [ imageBoxOpen , setImageBoxOpen ] = useState < boolean > ( false )
Original file line number Diff line number Diff line change @@ -70,7 +70,10 @@ type Query {
7070 @dbquery (
7171 type : " postgresql"
7272 schema : " public"
73- table : " post"
73+ query : " " "
74+ select * from " post "
75+ order by " post "." created_at " desc
76+ """
7477 configuration : " postgresql_config"
7578 )
7679 getPost (id : ID ! ): Post
You can’t perform that action at this time.
0 commit comments