Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add `Login.vue` file in `src/pages/` directory - Register `/login` route with `Login.vue` - Add `<Trash>` icon component Create `Trash.vue` file in `src/components/Icon/` directory - Install firebase & vuexfire ``` bash npm add firebase vuexfire ``` - Configure firebase
- Loading branch information
Showing
9 changed files
with
1,308 additions
and
223 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<svg class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="11" height="14" viewBox="0 0 11 14"> | ||
<path d="M4 5.75v4.5q0 0.109-0.070 0.18t-0.18 0.070h-0.5q-0.109 0-0.18-0.070t-0.070-0.18v-4.5q0-0.109 0.070-0.18t0.18-0.070h0.5q0.109 0 0.18 0.070t0.070 0.18zM6 5.75v4.5q0 0.109-0.070 0.18t-0.18 0.070h-0.5q-0.109 0-0.18-0.070t-0.070-0.18v-4.5q0-0.109 0.070-0.18t0.18-0.070h0.5q0.109 0 0.18 0.070t0.070 0.18zM8 5.75v4.5q0 0.109-0.070 0.18t-0.18 0.070h-0.5q-0.109 0-0.18-0.070t-0.070-0.18v-4.5q0-0.109 0.070-0.18t0.18-0.070h0.5q0.109 0 0.18 0.070t0.070 0.18zM9 11.406v-7.406h-7v7.406q0 0.172 0.055 0.316t0.113 0.211 0.082 0.066h6.5q0.023 0 0.082-0.066t0.113-0.211 0.055-0.316zM3.75 3h3.5l-0.375-0.914q-0.055-0.070-0.133-0.086h-2.477q-0.078 0.016-0.133 0.086zM11 3.25v0.5q0 0.109-0.070 0.18t-0.18 0.070h-0.75v7.406q0 0.648-0.367 1.121t-0.883 0.473h-6.5q-0.516 0-0.883-0.457t-0.367-1.105v-7.438h-0.75q-0.109 0-0.18-0.070t-0.070-0.18v-0.5q0-0.109 0.070-0.18t0.18-0.070h2.414l0.547-1.305q0.117-0.289 0.422-0.492t0.617-0.203h2.5q0.312 0 0.617 0.203t0.422 0.492l0.547 1.305h2.414q0.109 0 0.18 0.070t0.070 0.18z"></path> | ||
</svg> | ||
</template> | ||
|
||
<style scoped src="./icon.css"></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import firebase from 'firebase/app' | ||
|
||
import 'firebase/auth' | ||
import 'firebase/database' | ||
|
||
// Initialize Firebase | ||
const config = { | ||
apiKey: "AIzaSyD1uFXoNtk4tK4HIX3ikgg7EoFCphAWRaE", | ||
authDomain: "begin-again-workshop.firebaseapp.com", | ||
databaseURL: "https://begin-again-workshop.firebaseio.com", | ||
projectId: "begin-again-workshop", | ||
storageBucket: "begin-again-workshop.appspot.com", | ||
messagingSenderId: "436845609512" | ||
} | ||
|
||
firebase.initializeApp(config) | ||
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL) | ||
|
||
export const db = firebase.database() | ||
export const auth = firebase.auth() | ||
export const authProvider = new firebase.auth.GoogleAuthProvider() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<template> | ||
<div class="login-page"> | ||
<div> | ||
<h1>Markdown Notebook</h1> | ||
<button class="login" @click.prevent="login">Login</button> | ||
|
||
<div class="error" v-if="error">{{ error }}</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { auth, authProvider } from '../firebase' | ||
export default { | ||
data: () => ({ error: null }), | ||
beforeRouteEnter: (to, from, next) => { | ||
if (auth.currentUser) next({ path: '/' }) | ||
else next() | ||
}, | ||
methods: { | ||
async login () { | ||
try { | ||
await auth.signInWithPopup(authProvider) | ||
this.$router.push({ path: '/' }) | ||
} catch (error) { | ||
this.error = error.message | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.login-page { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
text-align: center; | ||
height: 100vh; | ||
} | ||
.login { | ||
background: #768; | ||
border: transparent; | ||
border-radius: 4px; | ||
color: white; | ||
font-size: 1.5rem; | ||
padding: 8px 32px; | ||
cursor: pointer; | ||
} | ||
.error { | ||
margin: 8px 16px; | ||
color: red; | ||
} | ||
</style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters