Skip to content

Commit

Permalink
extract contributors from doc response
Browse files Browse the repository at this point in the history
  • Loading branch information
ButteryCrumpet committed Apr 25, 2022
1 parent f52c855 commit 989beb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cloud/api/pages/teams/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ export async function getResourceShowPageData({
const [type, id] = getResourceFromSlug(resourceSlug)

if (type === prefixDocs) {
const [{ doc }, { data: token }] = await Promise.all([
const [{ doc: withContributors }, { data: token }] = await Promise.all([
callApi<GetDocResponseBody>(`api/docs/${id}`, { signal }),
callApi<{ data: string }>(`api/docs/${id}/token`, { signal }),
])

const { contributors, ...doc } = withContributors
return {
type: 'doc',
docs: [doc],
pageDoc: { ...doc, collaborationToken: token },
contributors,
}
}

Expand Down
1 change: 1 addition & 0 deletions src/cloud/interfaces/db/doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ export type SerializedDoc = SerializedUnserializableDocProps &
export type SerializedDocWithSupplemental = SerializedDoc & {
bookmarked: boolean
props: Props
contributors?: SerializedUser[]
}

0 comments on commit 989beb5

Please sign in to comment.