feat: mutations and queries for shortcode management
This commit is contained in:
@@ -4,5 +4,6 @@ export const keyDefs: GraphCacheKeysConfig = {
|
||||
User: (data) => data.uid!,
|
||||
TeamMember: (data) => data.membershipID!,
|
||||
Team: (data) => data.id!,
|
||||
Shortcode: (data) => data.id!,
|
||||
TeamInvitation: (data) => data.id!,
|
||||
}
|
||||
|
||||
@@ -14,5 +14,9 @@ export const resolversDef: GraphCacheResolvers = {
|
||||
__typename: "TeamInvitation",
|
||||
id: args.inviteID,
|
||||
}),
|
||||
shortcode: (_parent, args, _cache, _info) => ({
|
||||
__typename: "Shortcode",
|
||||
id: args.code,
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { gql } from "@urql/core"
|
||||
import { GraphCacheUpdaters, MyTeamsDocument } from "../graphql"
|
||||
|
||||
export const updatesDef: GraphCacheUpdaters = {
|
||||
@@ -168,5 +169,19 @@ export const updatesDef: GraphCacheUpdaters = {
|
||||
)
|
||||
}
|
||||
},
|
||||
createShortcode: (result, _args, cache, _info) => {
|
||||
cache.writeFragment(
|
||||
gql`
|
||||
fragment _ on Shortcode {
|
||||
id
|
||||
request
|
||||
}
|
||||
`,
|
||||
{
|
||||
id: result.createShortcode.id,
|
||||
request: result.createShortcode.request,
|
||||
}
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user