-
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.
Merge pull request #94 from P4-Games/feature/refactor-nft-claim
merge feature/refactor-nft-claim into develop
- Loading branch information
Showing
23 changed files
with
312 additions
and
156 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
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
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
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,3 +1,5 @@ | ||
export { useGetNftById } from './use-nft' | ||
|
||
export { useGetContact } from './use-contact' | ||
|
||
export { | ||
|
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { endpoints } from 'src/app/api/_hooks/api-resolver' | ||
|
||
import { useGetCommon } from './common' | ||
|
||
// ---------------------------------------------------------------------- | ||
|
||
export function useGetNftById(nftId: string) { | ||
return useGetCommon(endpoints.nft.id(nftId)) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { NextResponse } from 'next/server' | ||
|
||
import { getNftById } from 'src/app/api/_data/blk-service' | ||
|
||
import { IErrorResponse } from 'src/types/api' | ||
|
||
// ---------------------------------------------------------------------- | ||
|
||
type IParams = { | ||
id: string | ||
} | ||
|
||
// ---------------------------------------------------------------------- | ||
|
||
export async function GET(request: Request, { params }: { params: IParams }) { | ||
const errorMessage: IErrorResponse = { | ||
error: { | ||
code: 'NFT_NOT_FOUND', | ||
message: `NFT id '${params.id}' not found`, | ||
details: '', | ||
stack: '', | ||
url: request.url | ||
} | ||
} | ||
|
||
if (!params.id) { | ||
return new NextResponse(JSON.stringify(errorMessage), { | ||
status: 404, | ||
headers: { 'Content-Type': 'application/json' } | ||
}) | ||
} | ||
|
||
try { | ||
console.log('x') | ||
const response = (await getNftById(params.id)) || {} | ||
console.log('response backend get Nft By Id', response.data) | ||
if (response && response.image) { | ||
return NextResponse.json(response) | ||
} | ||
return new NextResponse(JSON.stringify(errorMessage), { | ||
status: 404, | ||
headers: { 'Content-Type': 'application/json' } | ||
}) | ||
} catch (ex) { | ||
console.error(ex) | ||
return new NextResponse(JSON.stringify({ error: 'Error getting NFT' }), { | ||
status: 400, | ||
headers: { 'Content-Type': 'application/json' } | ||
}) | ||
} | ||
} | ||
|
||
// ---------------------------------------------------------------------- |
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
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use client' | ||
|
||
import MainLayout from 'src/layouts/main' | ||
|
||
// ---------------------------------------------------------------------- | ||
|
||
type Props = { | ||
children: React.ReactNode | ||
} | ||
|
||
export default function Layout({ children }: Props) { | ||
return <MainLayout>{children}</MainLayout> | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { NftMintView } from 'src/sections/nfts/view' | ||
|
||
// ---------------------------------------------------------------------- | ||
|
||
export const metadata = { | ||
title: 'NFT Mint' | ||
} | ||
|
||
export default function NftMintPage({ params }: { params: { id: string } }) { | ||
return <NftMintView nftId={params.id} /> | ||
} |
File renamed without changes.
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
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
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
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
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
Oops, something went wrong.