mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-20 14:34:05 +01:00
Refactor ApplyBusiness component to update file upload path
This commit is contained in:
parent
6da89cc38b
commit
29be79f6e8
@ -35,6 +35,7 @@ export default function ApplyBusiness() {
|
|||||||
recvData["businessPitchDeck"],
|
recvData["businessPitchDeck"],
|
||||||
user.id,
|
user.id,
|
||||||
BUCKET_PITCH_NAME,
|
BUCKET_PITCH_NAME,
|
||||||
|
// file structure: userId/fileName
|
||||||
`${user?.id}/${recvData["businessPitchDeck"].name}`
|
`${user?.id}/${recvData["businessPitchDeck"].name}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -17,12 +17,32 @@ export default function ApplyProject() {
|
|||||||
const onSubmit: SubmitHandler<projectSchema> = async (data) => {
|
const onSubmit: SubmitHandler<projectSchema> = async (data) => {
|
||||||
alert("มาแน้ววว");
|
alert("มาแน้ววว");
|
||||||
console.table(data);
|
console.table(data);
|
||||||
|
console.log(typeof data["projectPhotos"], data["projectPhotos"]);
|
||||||
};
|
};
|
||||||
const sendApplication = async (recvData: any) => {
|
const sendApplication = async (recvData: any) => {
|
||||||
const {
|
const {
|
||||||
data: { user },
|
data: { user },
|
||||||
} = await supabase.auth.getUser();
|
} = await supabase.auth.getUser();
|
||||||
const pitchType = typeof recvData["businessPitchDeck"];
|
const pitchType = typeof recvData["projectPitchDeck"];
|
||||||
|
|
||||||
|
const { data, error } = await supabase
|
||||||
|
.from("business_application")
|
||||||
|
.insert([
|
||||||
|
{
|
||||||
|
user_id: user?.id,
|
||||||
|
business_name: recvData["projectName"],
|
||||||
|
business_type_id: recvData["industry"],
|
||||||
|
location: recvData["country"],
|
||||||
|
is_for_sale: recvData["isForSale"],
|
||||||
|
is_generating_revenue: recvData["isGenerating"],
|
||||||
|
is_in_us: recvData["isInUS"],
|
||||||
|
pitch_deck_url:
|
||||||
|
pitchType === "string" ? recvData["businessPitchDeck"] : "",
|
||||||
|
money_raised_to_date: recvData["totalRaised"],
|
||||||
|
community_size: recvData["communitySize"],
|
||||||
|
},
|
||||||
|
])
|
||||||
|
.select();
|
||||||
if (pitchType === "object") {
|
if (pitchType === "object") {
|
||||||
if (user?.id) {
|
if (user?.id) {
|
||||||
// const uploadSuccess = await uploadFile(
|
// const uploadSuccess = await uploadFile(
|
||||||
@ -41,25 +61,6 @@ export default function ApplyProject() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data, error } = await supabase
|
|
||||||
.from("business_application")
|
|
||||||
.insert([
|
|
||||||
{
|
|
||||||
user_id: user?.id,
|
|
||||||
business_name: recvData["companyName"],
|
|
||||||
business_type_id: recvData["industry"],
|
|
||||||
location: recvData["country"],
|
|
||||||
is_for_sale: recvData["isForSale"],
|
|
||||||
is_generating_revenue: recvData["isGenerating"],
|
|
||||||
is_in_us: recvData["isInUS"],
|
|
||||||
pitch_deck_url:
|
|
||||||
pitchType === "string" ? recvData["businessPitchDeck"] : "",
|
|
||||||
money_raised_to_date: recvData["totalRaised"],
|
|
||||||
community_size: recvData["communitySize"],
|
|
||||||
},
|
|
||||||
])
|
|
||||||
.select();
|
|
||||||
// console.table(data);
|
// console.table(data);
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: error == null ? "success" : "error",
|
icon: error == null ? "success" : "error",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user