Skip to content

Commit

Permalink
Feature/current jobs get data (#13)
Browse files Browse the repository at this point in the history
* Backend data

* axios api refactor
  • Loading branch information
DankaMarci authored Oct 11, 2024
1 parent aa295fd commit 222e498
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
60 changes: 30 additions & 30 deletions apps/frontend/src/components/CurrentJobs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
'use client';

import { useEffect, useState } from 'react';

import api from '../lib/axiosConfig';
import { Task } from './tasks-dto';

export default function CurrentJobs() {
const [tasks, setTasks] = useState<Task[]>([]);

const onGetData = () => {
api.get('/tasks').then((res) => {
setTasks(res.data);
});
};

useEffect(() => {
onGetData();
}, []);

return (
<div className='flex flex-col min-h-screen w-1/2'>
<div className='text-center pt-8'>
Expand All @@ -15,36 +34,17 @@ export default function CurrentJobs() {
</tr>
</thead>
<tbody>
<tr className='border-b border-neutral-200 transition duration-300 ease-in-out hover:bg-bg-color1 dark:border-white/10 dark:hover:bg-neutral-600'>
<td className='float-left whitespace-nowrap px-6 py-4 font-medium tracking-wider'>Felelős pozíciók</td>
<td className='float-right whitespace-nowrap px-6 py-4 font-medium'>.</td>
</tr>
<tr className='border-b border-neutral-200 transition duration-300 ease-in-out hover:bg-bg-color1 dark:border-white/10 dark:hover:bg-neutral-600'>
<td className='float-left whitespace-nowrap px-6 py-4 font-medium tracking-wider'>Projektmunkák</td>
<td className='float-right whitespace-nowrap px-6 py-4 font-medium'>.</td>
</tr>
<tr className='border-b border-neutral-200 transition duration-300 ease-in-out hover:bg-bg-color1 dark:border-white/10 dark:hover:bg-neutral-600'>
<td className='float-left whitespace-nowrap px-6 py-4 font-medium tracking-wider'>
Tanfolyam/mentorálás
</td>
<td className='float-right whitespace-nowrap px-6 py-4 font-medium'>.</td>
</tr>
<tr className='border-b border-neutral-200 transition duration-300 ease-in-out hover:bg-bg-color1 dark:border-white/10 dark:hover:bg-neutral-600'>
<td className='float-left whitespace-nowrap px-6 py-4 font-medium tracking-wider'>.</td>
<td className='float-right whitespace-nowrap px-6 py-4 font-medium'>.</td>
</tr>
<tr className='border-b border-neutral-200 transition duration-300 ease-in-out hover:bg-bg-color1 dark:border-white/10 dark:hover:bg-neutral-600'>
<td className='float-left whitespace-nowrap px-6 py-4 font-medium tracking-wider'>.</td>
<td className='float-right whitespace-nowrap px-6 py-4 font-medium'>.</td>
</tr>
<tr className='border-b border-neutral-200 transition duration-300 ease-in-out hover:bg-bg-color1 dark:border-white/10 dark:hover:bg-neutral-600'>
<td className='float-left whitespace-nowrap px-6 py-4 font-medium tracking-wider'>.</td>
<td className='float-right whitespace-nowrap px-6 py-4 font-medium'>.</td>
</tr>
<tr className='border-b border-neutral-200 transition duration-300 ease-in-out hover:bg-bg-color1 dark:border-white/10 dark:hover:bg-neutral-600'>
<td className='float-left whitespace-nowrap px-6 py-4 font-medium tracking-wider'>.</td>
<td className='float-right whitespace-nowrap px-6 py-4 font-medium'>.</td>
</tr>
{tasks.map((task) => (
<tr
key={task.id}
className='border-b border-neutral-200 transition duration-300 ease-in-out hover:bg-bg-color1 dark:border-white/10 dark:hover:bg-neutral-600'
>
<td className='float-left whitespace-nowrap px-6 py-4 font-medium tracking-wider'>
{task.description}
</td>
<td className='float-right whitespace-nowrap px-6 py-4 font-medium'>.</td>
</tr>
))}
</tbody>
</table>
</div>
Expand Down
8 changes: 8 additions & 0 deletions apps/frontend/src/components/tasks-dto.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type Task = {
id: number;
description: string;
sprintId: number;
userId: number;
projektId: number;
createdAt: Date;
};

0 comments on commit 222e498

Please sign in to comment.