Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup data.ts #22 #25

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions src/views/customer/CustomerListView/UpdateCustomer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
import { makeStyles } from '@material-ui/core';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import { useUpdateCustomerMutation } from 'src/generated/graphql'
Expand All @@ -8,23 +8,22 @@ import {
TextField,
} from '@material-ui/core';
import { UpdateProps } from './Types'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
typography: {
padding: theme.spacing(2),
textAlign: 'center',
},
box: {
margin: theme.spacing(2),
},
textfield: {
marginTop: theme.spacing(2),
},
button: {
margin: theme.spacing(1),
}
}),
);

const useStyles = makeStyles((theme: any) => ({
typography: {
padding: theme.spacing(2),
textAlign: 'center',
},
box: {
margin: theme.spacing(2),
},
textfield: {
marginTop: theme.spacing(2),
},
button: {
margin: theme.spacing(1),
}
}));

const UpdateCustomer: React.FC<UpdateProps> = ({ customer, handleClose }) => {
const classes = useStyles();
Expand Down
144 changes: 0 additions & 144 deletions src/views/customer/CustomerListView/data.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/views/customer/CustomerListView/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react';
import React, { useState } from 'react';
import {
Box,
Container,
Expand Down
13 changes: 13 additions & 0 deletions src/views/customer/CustomerListView/operation.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,16 @@ query searchCustomers($search: String!) {
updatedAt
}
}

query AllCustomers {
customers(order_by: { name: asc }) {
updatedAt
phone
name
id
email
createdAt
avatarUrl
address
}
}
16 changes: 8 additions & 8 deletions src/views/test/GeneratedCustomers.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import data from '../customer/CustomerListView/data'
import React, { useState } from 'react';
import GeneratedTable from './GeneratedCustomersTable'
import { useAllCustomersQuery } from 'src/generated/graphql';

const CustomerListView = () => {
const [customers] = useState(data);

return (
<GeneratedTable customers={customers} />
);
};
const [result] = useAllCustomersQuery({})
const { data, error, fetching } = result;

return (
<GeneratedTable customers={fetching ? {} : data.customers} />
);
};
export default CustomerListView