File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<template >
2- <div class =" page documents" >
2+ <div class =" page documents" >
33 <button @click =" toggleCollections" class =" button warning fab" ><i class =" fas fa-folder" v-if =" !collectionsOpen" ></i ><i class =" fas fa-folder-open" v-if =" collectionsOpen" ></i ></button >
44
55 <div v-if =" collectionsOpen" class =" folder-float box material" >
@@ -230,6 +230,7 @@ export default {
230230 this .collectionFilter = collection .key ;
231231 }
232232 },
233+
233234 addDocToCollection () {
234235 let docId = this .addDoc .userData .key ;
235236 let userId = this .addDoc .userData .uid ;
@@ -269,7 +270,26 @@ export default {
269270 }
270271 },
271272 remove (doc ) {
272- console .log (doc);
273+ swal ({
274+ title: " Are you sure?" ,
275+ text: ` You are about to remove this document from your library` ,
276+ icon: " warning" ,
277+ buttons: true ,
278+ dangerMode: true
279+ }).then (willDelete => {
280+ if (willDelete) {
281+ firebase
282+ .database ()
283+ .ref (` users/${ this .uid } /docs/${ doc .userData .key } ` )
284+ .remove ()
285+ .then (err => {
286+ swal ({
287+ text: " Removed from your library" ,
288+ icon: " success"
289+ });
290+ });
291+ }
292+ });
273293 },
274294 addToCollection (doc ) {
275295 this .addDoc = doc;
Original file line number Diff line number Diff line change 11<template >
2- <div class =" page editor" >
2+ <div @keypress.224.s.prevent = " saveDoc " @keypress.17.s.prevent = " saveDoc " class =" page editor" >
33 <loadingScreen v-if =" loading" ></loadingScreen >
44 <br />
55 <div class =" container" >
@@ -480,13 +480,26 @@ export default {
480480 }
481481 },
482482 remove () {
483- firebase
484- .database ()
485- .ref (` users/${ this .uid } /docs/${ this .docId } ` )
486- .remove ()
487- .then (() => {
488- swal (" Removed from your library" );
489- });
483+ swal ({
484+ title: " Are you sure?" ,
485+ text: ` You are about to remove this document from your library` ,
486+ icon: " warning" ,
487+ buttons: true ,
488+ dangerMode: true
489+ }).then (willDelete => {
490+ if (willDelete) {
491+ firebase
492+ .database ()
493+ .ref (` users/${ this .uid } /docs/${ this .docId } ` )
494+ .remove ()
495+ .then (() => {
496+ swal ({
497+ text: " Removed from your library" ,
498+ icon: " success"
499+ });
500+ });
501+ }
502+ });
490503 },
491504 closeSave () {
492505 this .shareSettings = false ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import App from "./App";
55import router from "./router" ;
66import VTooltip from 'v-tooltip'
77Vue . use ( VTooltip )
8+
89const firebase = require ( "firebase" ) ;
910let vueApp ;
1011const config = {
You can’t perform that action at this time.
0 commit comments