-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d2087b
commit 51d5416
Showing
2 changed files
with
49 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,39 @@ | ||
import { getUser, getUsers } from '@/app/apis/api'; | ||
import { getUsersSimple, getUserSimple } from '@/app/apis/api'; | ||
import { useTranslation } from '@/app/i18n'; | ||
import { Pagination, User } from '@/app/types/type'; | ||
|
||
export async function generateStaticParams() { | ||
// FIXME: Need a super user role to access api or build will fail | ||
const { results: users }: Pagination<User> = await getUsers(); | ||
const { results: users }: Pagination<User> = await getUsersSimple(); | ||
const ids = users.map((o) => { | ||
return { id: o.id.toString() }; | ||
}); | ||
return ids; | ||
} | ||
export default async function Page({ params: { lng, id: userId } }: any) { | ||
// TODO: TBD | ||
// // eslint-disable-next-line react-hooks/rules-of-hooks | ||
// const { t } = await useTranslation(lng, 'contracts'); | ||
// const user = await getUser(userId); | ||
// const currency = 'NTD'; | ||
// const { | ||
// email, | ||
// is_active, | ||
// is_superuser, | ||
// is_verified, | ||
// first_name, | ||
// last_name, | ||
// facebook_id, | ||
// line_id, | ||
// county, | ||
// district, | ||
// modify_time, | ||
// birth_date, | ||
// mobile, | ||
// create_time, | ||
// }: User = user; | ||
return <h1>hello user {userId}</h1>; | ||
// return ( | ||
// <h1> | ||
// A user {first_name} come from {county}, joined {create_time} | ||
// </h1> | ||
// ); | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const { t } = await useTranslation(lng, 'contracts'); | ||
const user: User = await getUserSimple(userId); | ||
const { | ||
email, | ||
first_name, | ||
last_name, | ||
mobile, | ||
facebook_id, | ||
line_id, | ||
county, | ||
district, | ||
create_time, | ||
last_login, | ||
} = user; | ||
return ( | ||
<> | ||
<h1 className="text-2xl font-bold">{first_name}</h1> | ||
<ul> | ||
<li>who lived in {county}</li> | ||
<li>joined since {create_time}</li> | ||
<li>last login at {last_login}</li> | ||
</ul> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters