Skip to content

Commit

Permalink
use useeffect
Browse files Browse the repository at this point in the history
  • Loading branch information
aleda145 committed Aug 2, 2022
1 parent d4d9bb3 commit 828421a
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions frontend/src/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
import React from "react";
import React, { useEffect } from "react";

export default function Dashboard({ client }) {
console.log(client);
return <h2>Dashboard {client.AuthStore.model.email}</h2>;
const getCars = async () => {
client.Records.getList("user_nums", 1, 50, {
filter: "created >= '2022-01-01 00:00:00'",
})
.then(function (list) {
// success...
console.log("list", list);
})
.catch(function (error) {
// error...
console.error("getlist error", error);
});
};
// console.log(client);
useEffect(() => {
getCars();
});
return (
<div>
<h2>Dashboard {client.AuthStore.model.email}</h2>
{/* <div>{getCars()}</div> */}
</div>
);
}

0 comments on commit 828421a

Please sign in to comment.