mirror of
https://github.com/rjNemo/melon_frontend
synced 2026-06-12 13:26:43 +00:00
refactor
This commit is contained in:
parent
7ee04ddef0
commit
735354da72
9 changed files with 31 additions and 38 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -19,3 +19,4 @@ yarn-error.log*
|
||||||
|
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
|
*.pem
|
||||||
|
|
@ -1,20 +1,17 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8"/>
|
||||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
<link rel="icon" href="%PUBLIC_URL%/favicon.ico"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
<meta name="theme-color" content="#000000" />
|
<meta name="theme-color" content="#000000"/>
|
||||||
<meta
|
<meta name="description" content="Web site created using create-react-app"/>
|
||||||
name="description"
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png"/>
|
||||||
content="Web site created using create-react-app"
|
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"/>
|
||||||
/>
|
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
||||||
<title>Melon | Property Management</title>
|
<title>Melon | Property Management</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { render, screen } from "@testing-library/react";
|
import { render, screen } from '@testing-library/react';
|
||||||
import App from "./App";
|
import App from './App';
|
||||||
|
|
||||||
test("renders learn react link", () => {
|
test('renders learn react link', () => {
|
||||||
render(<App />);
|
render(<App />);
|
||||||
const linkElement = screen.getByText(/learn react/i);
|
const linkElement = screen.getByText(/learn react/i);
|
||||||
expect(linkElement).toBeInTheDocument();
|
expect(linkElement).toBeInTheDocument();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import Router from "./Router";
|
import Router from './Router';
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return <Router />;
|
return <Router />;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ export const createBill = async (data: BillFormType) => {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateBill = async (id: number, data: BillFormType): Promise<Response<void>> => {
|
export const updateBill = async (id: number, data: BillFormType): Promise<Response<void>> => {
|
||||||
try {
|
try {
|
||||||
const { data: response } = await client.put<void>(`${billsURL}/${id}`, data);
|
const { data: response } = await client.put<void>(`${billsURL}/${id}`, data);
|
||||||
|
|
@ -21,6 +22,7 @@ export const updateBill = async (id: number, data: BillFormType): Promise<Respon
|
||||||
return { error };
|
return { error };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fetchOneBill = async (id: number): Promise<Response<Bill>> => {
|
export const fetchOneBill = async (id: number): Promise<Response<Bill>> => {
|
||||||
try {
|
try {
|
||||||
const { data } = await client.get<Bill>(`${billsURL}/${id}`);
|
const { data } = await client.get<Bill>(`${billsURL}/${id}`);
|
||||||
|
|
@ -30,6 +32,7 @@ export const fetchOneBill = async (id: number): Promise<Response<Bill>> => {
|
||||||
return { error };
|
return { error };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fetchAllBills = async () => {
|
export const fetchAllBills = async () => {
|
||||||
try {
|
try {
|
||||||
const { data } = await client.get<Bill[]>(billsURL);
|
const { data } = await client.get<Bill[]>(billsURL);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Form, Select } from "antd";
|
import { Form, Select } from 'antd';
|
||||||
import { Controller } from "react-hook-form";
|
import { Controller } from 'react-hook-form';
|
||||||
|
|
||||||
type InputSelectProps = {
|
type InputSelectProps = {
|
||||||
control: any;
|
control: any;
|
||||||
|
|
@ -24,7 +24,7 @@ export const InputSelect = ({ control, name, label, placeholder, options }: Inpu
|
||||||
}
|
}
|
||||||
options={options.map((label, value) => ({
|
options={options.map((label, value) => ({
|
||||||
value,
|
value,
|
||||||
label,
|
label
|
||||||
}))}
|
}))}
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
@import "antd/dist/antd.css";
|
@import 'antd/dist/antd.css';
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { ReportHandler } from "web-vitals";
|
import { ReportHandler } from 'web-vitals';
|
||||||
|
|
||||||
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
||||||
if (onPerfEntry) {
|
if (onPerfEntry) {
|
||||||
import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||||
getCLS(onPerfEntry);
|
getCLS(onPerfEntry);
|
||||||
getFID(onPerfEntry);
|
getFID(onPerfEntry);
|
||||||
getFCP(onPerfEntry);
|
getFCP(onPerfEntry);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"lib": [
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"esnext"
|
|
||||||
],
|
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
|
@ -23,10 +19,6 @@
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react-jsx"
|
"jsx": "react-jsx"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src"],
|
||||||
"src"
|
"exclude": ["node_modules"]
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue