Skip to content

Commit

Permalink
fix cloudinary to the register
Browse files Browse the repository at this point in the history
fix base url
  • Loading branch information
lksnjw committed Sep 28, 2024
1 parent 5eb7bd9 commit af1ac94
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 132 deletions.
18 changes: 10 additions & 8 deletions backend/controllers/DLDriverFormController.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncHandler from 'express-async-handler'
import DLDeliveryForm from '../models/DLDeliveryFormModel.js'

// Function to submit a delivery form
// Function to submit a delivery form
const submitDLDeliveryForm = asyncHandler(async (req, res) => {
const {
Expand All @@ -15,6 +16,9 @@ const submitDLDeliveryForm = asyncHandler(async (req, res) => {
address,
vehicleNumber,
vehicleType,
idCardImageUrl, // Image URLs passed from front-end
licenseImageUrl, // Image URLs passed from front-end
personalImageUrl, // Image URLs passed from front-end
} = req.body

// Check if a form with the same email already exists
Expand All @@ -27,11 +31,6 @@ const submitDLDeliveryForm = asyncHandler(async (req, res) => {
return
}

// Save the images
const idCardImageUrl = req.files['idCardImage'][0].path
const licenseImageUrl = req.files['licenseImage'][0].path
const personalImageUrl = req.files['personalImage'][0].path

// Create and save the delivery form
const deliveryForm = await DLDeliveryForm.create({
firstName,
Expand All @@ -45,17 +44,20 @@ const submitDLDeliveryForm = asyncHandler(async (req, res) => {
address,
vehicleNumber,
vehicleType,
idCardImageUrl,
licenseImageUrl,
personalImageUrl,
idCardImageUrl, // Directly saving the image URL passed from front-end
licenseImageUrl, // Directly saving the image URL passed from front-end
personalImageUrl, // Directly saving the image URL passed from front-end
})

// Respond with success message and saved form
res.status(201).json({
message: 'Form submitted successfully',
deliveryForm,
})
})



// Function to get all pending forms
const getPendingForms = asyncHandler(async (req, res) => {
const pendingForms = await DLDeliveryForm.find({ status: 'Pending' })
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/uploads/1727544307081-images (1).jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/uploads/1727544307081-images (2).jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/uploads/1727544350765-images (1).jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/uploads/1727544350765-images (2).jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/uploads/1727544653930-images (1).jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/uploads/1727544780630-images (1).jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions frontend/src/Pages/delivery/DLDriverAccept.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ const DLDriverAccept = () => {


// Construct the full URL for each image
const baseUrl = 'http://localhost:3000/'
const idCardImageUrl = `${baseUrl}${driverDetails.idCardImageUrl}`
const licenseImageUrl = `${baseUrl}${driverDetails.licenseImageUrl}`
const personalImageUrl = `${baseUrl}${driverDetails.personalImageUrl}`
// const baseUrl = 'http://localhost:3000/'
const idCardImageUrl = `${driverDetails.idCardImageUrl}`
const licenseImageUrl = `${driverDetails.licenseImageUrl}`
const personalImageUrl = `${driverDetails.personalImageUrl}`

return (

Expand Down
Loading

0 comments on commit af1ac94

Please sign in to comment.