Skip to content

Commit

Permalink
fix: viewUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
akicool committed Jan 5, 2025
1 parent f64aab1 commit bef105a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/api/upload/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function POST(request: NextRequest) {
}

// const viewUrl = `/image/${metaData[0].id}`;
const viewUrl = `/image/${randomUUID()}`;
const viewUrl = `/image/${metaData[0].unique_id}`;

return NextResponse.json({
success: true,
Expand Down
2 changes: 2 additions & 0 deletions src/components/ImageUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function ImageUploader() {
});

const data = await response.json();

if (data.success) {
toast.success("Успешно загружено");
setFile(null);
Expand Down Expand Up @@ -119,6 +120,7 @@ export function ImageUploader() {
<p className="text-sm text-gray-600 mb-2">
Ссылка для просмотра изображения:
</p>

<Link
href={viewUrl}
className="text-blue-500 hover:underline break-all inline-block px-4 py-2 bg-blue-100 rounded-md"
Expand Down

0 comments on commit bef105a

Please sign in to comment.