Skip to content

Commit

Permalink
minor/ui-bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutoshpadhi629 committed Sep 23, 2024
1 parent 38a5138 commit e689ff8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/components/job-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { FaFileUpload } from 'react-icons/fa';
import { Switch } from './ui/switch';
import { Label } from './ui/label';
import dynamic from 'next/dynamic';
import { uploadFileAction } from '@/actions/upload-to-cdn';

const DynamicLineDrawingAnimation = dynamic(
() => import('./gmaps-autosuggest'),
Expand Down Expand Up @@ -87,16 +88,12 @@ const PostJobForm = () => {
const uniqueFileName = `${Date.now()}-${file.name}`;
formData.append('uniqueFileName', uniqueFileName);

const res = await fetch(`/api/upload-to-cdn`, {
method: 'POST',
body: formData,
});

if (!res.ok) {
const res = await uploadFileAction(formData);
if (!res) {
throw new Error('Failed to upload image');
}

const uploadRes = await res.json();
const uploadRes = res;
return uploadRes.url;
} catch (error) {
console.error('Image upload failed:', error);
Expand Down Expand Up @@ -126,8 +123,7 @@ const PostJobForm = () => {
const response = await createJob(data);
if (!response.status) {
return toast({
title: response.name || 'Something went wrong',
description: response.message || 'Internal server error',
title: response.message || 'Error',
variant: 'destructive',
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Header = () => {

return (
<>
<nav className="fixed w-full z-50 backdrop-blur-md">
<nav className="fixed w-full z-50 backdrop-blur-md border">
<div className="flex h-[72px] w-full items-center justify-between lg:px-20 px-3 shadow-sm">
<Link href="/" className="p-2.5">
<CompanyLogo />
Expand Down

0 comments on commit e689ff8

Please sign in to comment.