JSFiddle - React, Tailwind, and code Playground

by eget teteete

JavaScript

import React from 'react';
import { useTranslation } from 'react-i18next';
import { EmployeeListProps } from '@digital.jit/services/tenant/ui-models';
// import { requireAuthentication } from '../../shared/guards/auth';
import Container from '../../shared/components/container';
import EmployeeList from '../../shared/components/employees/employees-list';
import tenant from '../../api/index';
import { getSession } from 'next-auth/client';
import { JiTSession } from '../api/auth/jitSession.interface';
import styles from './employees.module.scss';

const Employees = async () => {
  const { t } = useTranslation();
  const data = [];
  return (
    <Container title="Employees">
      <h1 className={styles.title}>{t('employees.title')}</h1>
      <section>
        <EmployeeList
          createEmployee={(data) => tenant.tenant.createEmployee(data)}
          employeesDataList={data}
        />
      </section>
    </Container>
  );
};

export default Employees; // requireAuthentication(Employees, '/login');

export async function getServerSideProps({ req }) {
  const session = (await getSession({ req })) as JiTSession;

  const { data: employeeData } = await tenant.tenant.getTenantEmployeesList(
    session.tenant.id);

  console.log('listData ', employeeData);
  return {
    props: { employeeData },
  };
}