File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,8 +46,6 @@ const init = function init() {
4646
4747
4848 } else {
49- // User is signed out.
50- // console.log('signed out');
5149 user . displayName = '' ;
5250 user . email = '' ;
5351 user . emailVerified = false ;
Original file line number Diff line number Diff line change 1717</template >
1818
1919<script >
20- import firebase from ' firebase' ;
21- import { database } from ' ../../firebaseInstance' ;
2220 import Books from ' ../Books'
2321 import Search from ' ./Search' ;
24- import Vuex from ' vuex' ;
2522
2623 export default {
2724 components: { Books, Search }
2825 };
2926 </script >
30-
31- <style >
32-
33- </style >
Original file line number Diff line number Diff line change 5050 height : 100px ;
5151 display : inline ;
5252 }
53- </style >
54-
55- <style >
5653 .el-autocomplete-suggestion li {
5754 margin : 4px 0 ;
5855 }
10097 }
10198 });
10299
100+
101+ const apiKey = " AIzaSyBPhoh6CYEtQ2SQhhU5XzK-OwB9WIfteCE" ;
103102 function querySearchAsync (queryString , cb ) {
104- fetch (` https://www.googleapis.com/books/v1/volumes?q=${ queryString} &key=AIzaSyBPhoh6CYEtQ2SQhhU5XzK-OwB9WIfteCE ` )
103+ fetch (` https://www.googleapis.com/books/v1/volumes?q=${ queryString} &key=${ apiKey } ` )
105104 .then (response => {
106105 return response .json ()
107106 })
108107 .then (json => {
109108 cb (json .items .map (e => {
110109 return {
111- value: e .volumeInfo .title , // TODO how to send title directly in the callback.
110+ value: e .volumeInfo .title ,
112111 title: e .volumeInfo .title || ' ' ,
113112 subtitle: e .volumeInfo .subtitle || ' ' ,
114113 description: e .volumeInfo .description || ' ' ,
129128 export default Vue .extend ({
130129 name: ' Search' ,
131130 props: [' Search' ],
132- ready () {
133- var self = this ;
134- },
135131 data () {
136132 return {
137133 textfieldBook: ' ' ,
148144 if (this .selectedItem ) {
149145 booksRef .push (this .selectedItem );
150146 }
147+ this .$notify ({
148+ title: ' Added' ,
149+ message: ' Successfuly added book!' ,
150+ type: ' success'
151+ });
151152 },
152153 querySearchAsync,
153154 createFilter (queryString ) {
Original file line number Diff line number Diff line change 4949 },
5050 methods: {
5151 details (currentBook ) {
52- console .log (currentBook);
5352 this .currentBook = currentBook;
5453 this .dialogVisible = true ;
5554 }
Original file line number Diff line number Diff line change 44 <div class =" product-list-container clearfix" >
55 <article class =" product-list-item clearfix" v-for =" book in books" >
66 <a @click =" details(book['.key'])" class =" product-list-item-image-container cursor-hover" >
7-
8- <div v-if =" true === false" >
9- <el-badge value =" borrowed" class =" item" >
10- <img class =" product-list-item-image" :src =" book.image.thumbnail" alt =" alternative-image" >
11- </el-badge >
12- </div >
13- <div v-else >
147 <img class =" product-list-item-image" :src =" book.image.thumbnail" alt =" alternative-image" >
15- </div >
16-
178 </a >
189 <div class =" product-list-item-price" >
1910 <div class =" price-container" >
3526 <div class =" product-list-item-share" >
3627 <div >
3728 <el-button plain type =" text" class =" button" @click =" details(book)" >Details</el-button >
38- <el-button plain type =" text" class =" button" :href =" book.preview" target =" _blank" >Preview</el-button >
3929 <el-button plain type =" text" class =" button" @click =" removeBook(book['.key'])" >Delete</el-button >
4030 </div >
4131 </div >
7464 details (book ) {
7565 eventHub .$emit (' open-modal' , book)
7666 },
77- handleSelect (key , keyPath ) {
78- console .log (key, keyPath);
79- },
8067 removeBook (key ) {
8168 booksRef .child (key).remove ();
82- this .$notify ({
83- title: ' Deleted' ,
84- message: ' Successfuly deleted book!' ,
85- type: ' success'
86- });
69+ this .$notify ({
70+ title: ' Deleted' ,
71+ message: ' Successfuly deleted book!' ,
72+ type: ' success'
73+ });
8774 this .dialogVisible = false ;
8875 }
8976 },
Original file line number Diff line number Diff line change 8888 info: ' https://red.assist.ro/projects/assist/wiki/Tutoriale'
8989 }]
9090 }
91- },
92- methods: {
93- handleClick (e ) {
94- console .log (' click' , e);
95- }
96- },
91+ }
9792 });
9893
9994 </script >
Original file line number Diff line number Diff line change @@ -11,14 +11,14 @@ import store from './vuex/store'
1111import firebase from 'firebase'
1212import lang from 'element-ui/lib/locale/lang/en'
1313import locale from 'element-ui/lib/locale'
14+ import { init } from './auth' ;
1415
15- locale . use ( lang )
16+ locale . use ( lang ) ;
1617
1718
18- Vue . use ( VuexFire )
19- Vue . use ( ElementUI )
19+ Vue . use ( VuexFire ) ;
20+ Vue . use ( ElementUI ) ;
2021
21- import { init } from './auth' ;
2222
2323init ( ) ;
2424
Original file line number Diff line number Diff line change @@ -24,12 +24,12 @@ const router = new Router({
2424 {
2525 path : '/admin' ,
2626 name : 'Admin' ,
27- meta : { //TODO this should require auth AND the admin role ICHIM
27+ meta : {
2828 requiresAuth : true ,
2929 } ,
3030 component : Admin ,
3131 } ,
32- {
32+ {
3333 path : '/dashboard' ,
3434 name : 'Dashboard' ,
3535 meta : {
You can’t perform that action at this time.
0 commit comments