Skip to content

Commit

Permalink
feat: sources
Browse files Browse the repository at this point in the history
  • Loading branch information
deewakar-k committed Dec 26, 2024
1 parent f0a6cbe commit 6bcb1f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/frontend/src/components/objects/ListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const ListView: React.FC = () => {
<section className="no-scrollbar flex h-full flex-col gap-2 overflow-y-auto">
<section className="flex flex-col gap-2.5">
<ItemList
items={items}
items={items.slice().reverse()}
handleExpand={handleExpand}
handleRescheduleCalendar={handleCalendarClick}
/>
Expand Down
24 changes: 12 additions & 12 deletions apps/frontend/src/lib/server/actions/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ export async function createItem(session: string | null, data: Partial<Item>) {
}
}

export async function getItemsByType(session: string | null, type: string) {
if (!session) {
console.error("no session provided")
throw new Error("session is required")
export async function getItemsByType(session: string, type: string) {
let url = `${BACKEND_URL}/api/items`

if (type === "linear" || type === "github") {
url += `?source=${type}`
} else {
url += `?type=${type}`
}

try {
const res = await axios.get<ItemResponse>(
`${BACKEND_URL}/api/items/${type}`,
{
headers: {
Authorization: `Bearer ${session}`,
},
}
)
const res = await axios.get<ItemResponse>(url, {
headers: {
Authorization: `Bearer ${session}`,
},
})

return res.data.items || []
} catch (error) {
Expand Down

0 comments on commit 6bcb1f8

Please sign in to comment.