Skip to content

Commit

Permalink
Merge pull request #40 from litencatt/fix-db-id-feeded-db-name-display
Browse files Browse the repository at this point in the history
Get db title from db id and set
  • Loading branch information
litencatt committed Dec 17, 2023
2 parents 0843cbd + 3f8e445 commit 9aa92e1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,23 @@ app.action("open-modal-button", async ({ ack, body, client, logger }) => {
view: slack.searchDbView(metaData, dbs),
})
} else {
const dbs = await cache.getDatabases()
const dbTitle = await notion.getDatabaseTitle(dbs)
const resRetrieve = await notion.client.databases.retrieve({
database_id: dbId,
})
const dbTitle = await notion.getDatabaseTitle(resRetrieve)
const resQuery = await notion.client.databases.query({
database_id: dbId,
page_size: 10,
})
const metaData: MetaData = {
channel_id: body.channel.id,
thread_ts: body.message.thread_ts,
selected_db_id: dbId,
selected_db_name: dbTitle,
filter_values: [],
}

const res = await notion.client.databases.query({
database_id: dbId,
page_size: 10,
})
const urls = await notion.getPageUrls(res)
const nextCursor = res.has_more ? res.next_cursor : ""
const urls = await notion.getPageUrls(resQuery)
const nextCursor = resQuery.has_more ? resQuery.next_cursor : ""
metaData.next_cursor = nextCursor

await client.views.open({
Expand Down

0 comments on commit 9aa92e1

Please sign in to comment.