Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/components/LoginModel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function LoginModel({ open, onClose }) {
dispatch(setUserData(data))
onClose()
} catch (error) {
console.log(error)
console.error(error)
}
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/hooks/useGetCurrentUser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function useGetCurrentUser() {
)
dispatch(setUserData(result.data))
} catch (error) {
console.log(error)
console.error(error)
} finally {
dispatch(setUserLoading(false))
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Dashboard = () => {
)
)
} catch (error) {
console.log(error)
console.error(error)
}
}

Expand All @@ -38,7 +38,7 @@ const Dashboard = () => {
setWebsites(result.data || [])
setLoading(false)
} catch (error) {
console.log(error)
console.error(error)
setError(error.response?.data?.message || "Something went wrong")
setLoading(false)
}
Expand Down
8 changes: 4 additions & 4 deletions client/src/pages/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function WebsiteEditor() {
{}, { withCredentials: true })
window.open(`${result.data.url}`, "_blank")
} catch (error) {
console.log(error)
console.error(error)
}
}

Expand All @@ -46,13 +46,13 @@ function WebsiteEditor() {
setMessages((m) => [...m, { role: "user", content: prompt }])
try {
const result = await axios.post(`${serverUrl}/api/website/update/${id}`, { prompt: text }, { withCredentials: true })
console.log(result)

setUpdateLoading(false)
setMessages((m) => [...m, { role: "ai", content: result.data.message }])
setCode(result.data.code)
} catch (error) {
setUpdateLoading(false)
console.log(error)
console.error(error)
}
}

Expand All @@ -74,7 +74,7 @@ function WebsiteEditor() {
setCode(result.data.latestCode)
setMessages(result.data.conversation)
} catch (error) {
console.log(error)
console.error(error)
setError(error.response?.data?.message || "Something went wrong")
}
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/Generate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ function Generate() {
try {
const result = await axios.post(`${serverUrl}/api/website/generate`, { prompt },
{ withCredentials: true })
console.log(result)

setProgress(100)
setLoading(false)
navigate(`/editor/${result.data.websiteId}`)
} catch (error) {
setLoading(false)
setError(error.response?.data?.message || "Something went wrong!")
console.log(error)
console.error(error)
}
}

Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Home = () => {
setWebsites(null)
navigate("/")
} catch (error) {
console.log(error)
console.error(error)
}
}
const profileRef = useRef(null)
Expand All @@ -56,7 +56,7 @@ const Home = () => {
setWebsites(result.data || [])
setLoading(false)
} catch (error) {
console.log(error)
console.error(error)
setLoading(false)
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/LiveSite.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function LiveSite() {
setHtml(result.data.latestCode)

} catch (error) {
console.log(error)
console.error(error)
setError("Site not found")
}
}
Expand Down
23 changes: 11 additions & 12 deletions client/src/pages/Pricing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,14 @@ function Pricing() {
const selectedPlan = plans.find(p => p.key === planKey)
setLoadingPlan(planKey)
try {
const result = await axios.post
(`${serverUrl}/api/payment/order`,
{
planId: planKey,
amount: parseInt(selectedPlan.price.replace("₹", "")), // or hardcode
credits: selectedPlan.credits
},
{ withCredentials: true }
)
const result = await axios.post(`${serverUrl}/api/payment/order`,
{
planId: planKey,
amount: parseInt(selectedPlan.price.replace("₹", "")), // or hardcode
credits: selectedPlan.credits
},
{ withCredentials: true }
)

const options = {
key: import.meta.env.VITE_RAZORPAY_KEY_ID,
Expand All @@ -98,10 +97,10 @@ function Pricing() {

alert("Payment Successful 🎉")

window.location.href = "/dashboard"
navigate("/dashboard")

} catch (err) {
console.log(err)
console.error(err)
alert("Verification failed ❌")
}
}
Expand All @@ -111,7 +110,7 @@ function Pricing() {
rzp.open()

} catch (error) {
console.log(error)
console.error(error)
setLoadingPlan(false)
}
}
Expand Down
31 changes: 31 additions & 0 deletions render.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
services:
- type: web
name: webify-ai-frontend
env: static
buildCommand: npm install && npm run build
staticPublishPath: dist
rootDir: client
routes:
- type: rewrite
source: /*
destination: /index.html

- type: web
name: webify-ai-backend
env: node
buildCommand: npm install
startCommand: node index.js
rootDir: server
envVars:
- key: PORT
value: 5000
- key: FRONTEND_URL
sync: false
- key: MONGO_URI
sync: false
- key: JWT_SECRET
sync: false
- key: RAZORPAY_KEY_ID
sync: false
- key: RAZORPAY_SECRET_KEY
sync: false
2 changes: 1 addition & 1 deletion server/controllers/website.controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export const deploy = async (req, res) => {
.slice(0, 60) + website._id.toString().slice(-5);
}
website.deployed = true
website.deployUrl = `${process.env.FRONTEND_URL}/site/${website.slug}`
website.deployUrl = `${process.env.FRONTEND_URL || "https://webify-ai-1.onrender.com"}/site/${website.slug}`
await website.save()

return res.status(200).json({
Expand Down