diff --git a/frontend/next.config.js b/frontend/next.config.js new file mode 100644 index 0000000..ba002c4 --- /dev/null +++ b/frontend/next.config.js @@ -0,0 +1,30 @@ + + /** @type {import('next').NextConfig} */ +const nextConfig = { + output: 'export', + async headers() { + return [ + { + // matching all API routes + source: "/api/v1/:path*", + headers: [ + { key: "Access-Control-Allow-Credentials", value: "true" }, + { key: "Access-Control-Allow-Origin", value: "*" }, + { key: "Access-Control-Allow-Methods", value: "GET,OPTIONS,PATCH,DELETE,POST,PUT" }, + { key: "Access-Control-Allow-Headers", value: "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" }, + ] + } + ] + }, + async rewrites() { + return [ + { + source: '/api/v1/:path*', // Match all routes starting with /api/v1/ + destination: 'http://localhost:8080/api/v1/:path*', // Proxy to backend server + }, + ]; + }, +}; + +module.exports = nextConfig; + \ No newline at end of file diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs index 7aad706..e69de29 100644 --- a/frontend/next.config.mjs +++ b/frontend/next.config.mjs @@ -1,14 +0,0 @@ -/** @type {import('next').NextConfig} */ -const nextConfig = - { async rewrites() { - return [ - { - source: '/api/v1/:path*', - destination: 'http://localhost:8080/:path*' // Proxy to Backend - } - ] - }, - output: 'export' - }; - -export default nextConfig; diff --git a/frontend/package.json b/frontend/package.json index b878a44..ada05b4 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev -p 9000", + "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index 2072f9b..3dd773b 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -32,14 +32,14 @@ export default function Home() { const onMint = async () => { const requestData = { - asset_name: 'WST', + asset_name: Buffer.from('WST', 'utf8').toString('hex'), // Convert "WST" to hex issuer: mintAccount, - amount: mintTokens, + quantity: mintTokens, }; try { const response = await axios.post( - 'http://localhost:9000/api/tx/programmable-token/issue', + '/api/v1/tx/programmable-token/issue', requestData, { headers: { @@ -47,7 +47,6 @@ export default function Home() { }, } ); - console.log('Mint response:', response.data); } catch (error) { console.error('Minting failed:', error);