Commit fc770615 by ramdayalmunda

close popup when recording starts

parent 3d0f3bca
!function () { !function () {
const origin = "http://localhost:3039" const origin = "http://localhost:3039"
console.log('popup', chrome);
const api = axios.create({ const api = axios.create({
baseURL: `${origin}/api`, // the base URL for nodeserver is okay but NGINX is giving error baseURL: `${origin}/api`, // the base URL for nodeserver is okay but NGINX is giving error
...@@ -28,23 +27,17 @@ ...@@ -28,23 +27,17 @@
startBtn.addEventListener('click', async function () { startBtn.addEventListener('click', async function () {
if (inProgress){ if (inProgress){
console.log('something in progress');
return return
} }
inProgress = true inProgress = true
try{ try{
let { data } = await api.post('/tutor-shot', { title: "Some random title" }, { headers: { userId: userDetails.uid } } ) let { data } = await api.post('/tutor-shot', { title: "Some random title" }, { headers: { userId: userDetails.uid } } )
console.log('creating reponse',data)
if (data.success){ if (data.success){
chrome.runtime.sendMessage({ action: "startRecording", tutorShotId:data.tutorShot._id }, async function (response) { chrome.runtime.sendMessage({ action: "startRecording", tutorShotId:data.tutorShot._id }, async function (response) {
recording = response.recording recording = response.recording
console.log('to start. we need api', api)
modifyPopupUI() modifyPopupUI()
inProgress = false inProgress = false
window.close()
}) })
} }
}catch(err){ }catch(err){
...@@ -56,7 +49,6 @@ ...@@ -56,7 +49,6 @@
stopBtn.addEventListener('click', function () { stopBtn.addEventListener('click', function () {
if (inProgress){ if (inProgress){
console.log('something in progress');
return return
} }
inProgress = true inProgress = true
...@@ -68,7 +60,6 @@ ...@@ -68,7 +60,6 @@
}) })
function modifyPopupUI() { function modifyPopupUI() {
console.log('modify ui', userDetails)
loginBtn.style.display = loggedIn ? 'none' : '' loginBtn.style.display = loggedIn ? 'none' : ''
startBtn.style.display = loggedIn ? (recording ? 'none' : '') : 'none' startBtn.style.display = loggedIn ? (recording ? 'none' : '') : 'none'
stopBtn.style.display = loggedIn ? (!recording ? 'none' : '') : 'none' stopBtn.style.display = loggedIn ? (!recording ? 'none' : '') : 'none'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment