diff --git a/src/components/Navigation.vue b/src/components/Navigation.vue index 663136a..c4eadde 100644 --- a/src/components/Navigation.vue +++ b/src/components/Navigation.vue @@ -204,11 +204,12 @@ header { font-weight: 300; font-size: 16px; padding: 0 8px; - transition: 0.3s color ease; + border-radius: 30px; + transition: 0.3s background-color ease; } .link:hover { - color: red; + background-color: #eb9d63; } .logo { diff --git a/src/views/Cart.vue b/src/views/Cart.vue index 2509c86..574aaca 100644 --- a/src/views/Cart.vue +++ b/src/views/Cart.vue @@ -12,13 +12,14 @@ {{ item.quantity }} - +

Cart Summary

Total Items: {{ cartItemCount }}

Total Price: {{ cartTotal | currency }}

+
@@ -41,16 +42,31 @@ export default { + diff --git a/src/views/Login.vue b/src/views/Login.vue index 5ec1efb..6fb4568 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -18,12 +18,18 @@
{{ this.errorMsg }}
Forgot your password? - + + - + + diff --git a/src/views/Register.vue b/src/views/Register.vue index 2aab646..aedfb48 100644 --- a/src/views/Register.vue +++ b/src/views/Register.vue @@ -1,37 +1,42 @@ @@ -42,57 +47,197 @@ import password from '../assets/Icons/lock-alt-solid.svg'; import user from '../assets/Icons/user-alt-light.svg'; import firebase from 'firebase/app'; import 'firebase/auth'; -import db from '../firebase/firebaseInit' +import db from '../firebase/firebaseInit'; + export default { - name:'Register', - components: { email , password , user }, - data(){ - return{ + name: 'Register', + components: { email, password, user }, + data() { + return { firstName: "", lastName: "", userName: "", email: "", password: "", - error: "", + error: false, errorMsg: "", + loading: false, }; }, - methods:{ - async register(){ - if( - this.firstName !== '' && - this.lastName !== '' && - this.userName !== '' && - this.email !== '' && - this.password !== '' - ) { + methods: { + async register() { + if (this.firstName && this.lastName && this.userName && this.email && this.password) { this.error = false; this.errorMsg = ''; - const firebaseAuth = await firebase.auth() - const createUser = await firebaseAuth.createUserWithEmailAndPassword(this.email , this.password); - const result = await createUser; - const database = db.collection('users').doc(result.user.uid); - await database.set({ - firstName: this.firstName, - lastName: this.lastName, - userName: this.userName, - email : this.email, - password: this.password - }) - this.$router.push({name: "Home"}) - return; + this.loading = true; + try { + const firebaseAuth = await firebase.auth(); + const createUser = await firebaseAuth.createUserWithEmailAndPassword(this.email, this.password); + const result = await createUser; + const database = db.collection('users').doc(result.user.uid); + await database.set({ + firstName: this.firstName, + lastName: this.lastName, + userName: this.userName, + email: this.email, + password: this.password + }); + this.$router.push({ name: "Home" }); + } catch (error) { + this.error = true; + this.errorMsg = error.message; + } finally { + this.loading = false; + } + } else { + this.error = true; + this.errorMsg = 'Please fill out all the fields'; } - this.error = true; - this.errorMsg = 'Please fill out all the fields'; - return; }, + async googleSignIn() { + this.loading = true; + try { + const provider = new firebase.auth.GoogleAuthProvider(); + const result = await firebase.auth().signInWithPopup(provider); + const user = result.user; + const database = db.collection('users').doc(user.uid); + await database.set({ + firstName: user.displayName.split(' ')[0], + lastName: user.displayName.split(' ')[1], + userName: user.displayName, + email: user.email, + }); + this.$router.push({ name: "Home" }); + } catch (error) { + this.error = true; + this.errorMsg = error.message; + } finally { + this.loading = false; + } + } } -} +}; \ No newline at end of file +@keyframes spin { + to { + transform: rotate(360deg); + } +} +