From 4f37c4d4c91fcf50ebc1e2d2d7894f6b040d5d71 Mon Sep 17 00:00:00 2001 From: DanYu12 Date: Tue, 26 Sep 2023 00:07:43 -0400 Subject: [PATCH] added resume url --- src/App.jsx | 2 +- src/pages/Application.jsx | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index f42070e..88ecea4 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -16,7 +16,7 @@ const router = createBrowserRouter( } /> } /> - {/* } /> */} + } /> } /> } /> diff --git a/src/pages/Application.jsx b/src/pages/Application.jsx index 56bb230..26e8c6d 100644 --- a/src/pages/Application.jsx +++ b/src/pages/Application.jsx @@ -6,7 +6,7 @@ import { useNavigate } from 'react-router-dom'; import { auth, db, storage } from '../firebase/firebase-config'; import { useAuthState } from 'react-firebase-hooks/auth'; import { doc, updateDoc } from 'firebase/firestore'; -import { ref, uploadBytes } from 'firebase/storage'; +import { ref, uploadBytes, getDownloadURL } from 'firebase/storage'; import { useForm, Controller } from 'react-hook-form'; import Select from 'react-select'; @@ -146,8 +146,12 @@ const Application = ({ applicationId }) => { if (resume != null) { const resumeRef = ref(storage, `${applicationId}`); + const resumeURL = await getDownloadURL(resumeRef); + console.log(resumeURL); uploadBytes(resumeRef, resume).then(() => { - navigate('/login'); + updateDoc(userDoc, { + resumeURL: resumeURL, + }).then(navigate('/login')); }); } else { alert('please upload a resume'); @@ -658,14 +662,12 @@ const Application = ({ applicationId }) => { render={({ field }) => (