Skip to content

Commit 4edf88f

Browse files
committed
Initial commit
0 parents  commit 4edf88f

26 files changed

+6068
-0
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_size = 2
6+
indent_style = space
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
root: true,
3+
parser: 'babel-eslint',
4+
env: {
5+
browser: true,
6+
node: true
7+
},
8+
extends: 'standard',
9+
// required to lint *.vue files
10+
plugins: [
11+
'html'
12+
],
13+
// add your custom rules here
14+
rules: {},
15+
globals: {}
16+
}

.firebaserc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "nuxt-firebase-auth"
4+
}
5+
}

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# dependencies
2+
node_modules
3+
4+
# logs
5+
npm-debug.log
6+
7+
# Nuxt build
8+
.nuxt
9+
10+
# Nuxt generate
11+
dist

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# nuxt-lowdb
2+
3+
> Nuxt.js project
4+
5+
## Build Setup
6+
7+
``` bash
8+
# install dependencies
9+
$ npm install # Or yarn install
10+
11+
# serve with hot reload at localhost:3000
12+
$ npm run dev
13+
14+
# build for production and launch server
15+
$ npm run build
16+
$ npm start
17+
18+
# generate static project
19+
$ npm run generate
20+
```
21+
22+
For detailed explanation on how things work, checkout the [Nuxt.js docs](https://github.com/nuxt/nuxt.js).

assets/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ASSETS
2+
3+
This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.
4+
5+
More information about the usage of this directory in the documentation:
6+
https://nuxtjs.org/guide/assets#webpacked
7+
8+
**This directory is not required, you can delete it if you don't want to use it.**

assets/css/main.css

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.page-enter-active, .page-leave-active {
2+
transition: all .45s ease-in-out;
3+
transition: all .45s cubic-bezier(.55,0,.1,1);
4+
5+
// transform: translate(30px, 0);
6+
}
7+
.page-enter, .page-leave-active {
8+
opacity: 0;
9+
transform: translate(10px, 0);
10+
}

components/Login.vue

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<div class="login">
3+
<h5>Login</h5>
4+
<div><label for="email">Email<input type="text" v-model="formEmail" name="email"></label></div>
5+
<div><label for="email">Password<input type="text" v-model="formPassword" name="password"></label></div>
6+
<button @click="login">Login</button>
7+
<hr>
8+
<!-- <button @click="googleSignUp">Google Sign In</button> -->
9+
</div>
10+
</template>
11+
12+
<script>
13+
export default {
14+
data () {
15+
return {
16+
formEmail: '',
17+
formPassword: ''
18+
}
19+
},
20+
methods: {
21+
login () {
22+
this.$store.dispatch('userSignIn', {
23+
email: this.formEmail,
24+
password: this.formPassword
25+
}).then(() => {
26+
this.formEmail = ''
27+
this.formPassword = ''
28+
}).catch((e) => {
29+
console.log(e.message);
30+
})
31+
}
32+
}
33+
}
34+
</script>
35+
36+
<style lang="css">
37+
</style>

components/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# COMPONENTS
2+
3+
The components directory contains your Vue.js Components.
4+
Nuxt.js doesn't supercharge these components.
5+
6+
**This directory is not required, you can delete it if you don't want to use it.**

firebase.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"hosting": {
3+
"public": "dist"
4+
}
5+
}

layouts/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# LAYOUTS
2+
3+
This directory contains your Application Layouts.
4+
5+
More information about the usage of this directory in the documentation:
6+
https://nuxtjs.org/guide/views#layouts
7+
8+
**This directory is not required, you can delete it if you don't want to use it.**

layouts/default.vue

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<template>
2+
<div>
3+
<nuxt/>
4+
</div>
5+
</template>
6+
7+
<style>
8+
html {
9+
font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
10+
font-size: 16px;
11+
word-spacing: 1px;
12+
-ms-text-size-adjust: 100%;
13+
-webkit-text-size-adjust: 100%;
14+
-moz-osx-font-smoothing: grayscale;
15+
-webkit-font-smoothing: antialiased;
16+
box-sizing: border-box;
17+
}
18+
19+
*, *:before, *:after {
20+
box-sizing: border-box;
21+
margin: 0;
22+
}
23+
24+
.button--green {
25+
display: inline-block;
26+
border-radius: 4px;
27+
border: 1px solid #3b8070;
28+
color: #3b8070;
29+
text-decoration: none;
30+
padding: 10px 30px;
31+
}
32+
33+
.button--green:hover {
34+
color: #fff;
35+
background-color: #3b8070;
36+
}
37+
38+
.button--grey {
39+
display: inline-block;
40+
border-radius: 4px;
41+
border: 1px solid #35495e;
42+
color: #35495e;
43+
text-decoration: none;
44+
padding: 10px 30px;
45+
margin-left: 15px;
46+
}
47+
48+
.button--grey:hover {
49+
color: #fff;
50+
background-color: #35495e;
51+
}
52+
.container {
53+
min-height: 100vh;
54+
display: flex;
55+
padding: 2em;
56+
justify-content: center;
57+
align-items: flex-start;
58+
flex-flow: row wrap;
59+
/*text-align: center;*/
60+
}
61+
.container > div {
62+
flex-basis: 100%;
63+
}
64+
65+
.title {
66+
font-family: "Quicksand", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; /* 1 */
67+
display: block;
68+
font-weight: 300;
69+
font-size: 2.5em;
70+
color: #35495e;
71+
letter-spacing: 1px;
72+
margin-top: 0;
73+
}
74+
75+
.subtitle {
76+
font-weight: 300;
77+
font-size: 42px;
78+
color: #526488;
79+
word-spacing: 5px;
80+
padding-bottom: 15px;
81+
}
82+
83+
.links {
84+
padding-top: 15px;
85+
}
86+
@media (min-width: 750px) {
87+
.title {
88+
font-size: 5em;
89+
}
90+
}
91+
</style>

middleware/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# MIDDLEWARE
2+
3+
This directory contains your Application Middleware.
4+
The middleware lets you define custom function to be ran before rendering a page or a group of pages (layouts).
5+
6+
More information about the usage of this directory in the documentation:
7+
https://nuxtjs.org/guide/routing#middleware
8+
9+
**This directory is not required, you can delete it if you don't want to use it.**

middleware/auth.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default function ({ app, route, store, redirect, error, isClient }) {
2+
console.log(store.state.user);
3+
if (store.state.user == null) {
4+
redirect('/')
5+
}
6+
}

nuxt.config.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = {
2+
head: {
3+
title: 'Nuxt Firebae Auth',
4+
meta: [
5+
{ charset: 'utf-8' },
6+
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
7+
{ hid: 'description', name: 'description', content: 'Nuxt.js project' }
8+
],
9+
link: [
10+
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
11+
{ rel: 'stylesheet', href: 'https://unpkg.com/ace-css/css/ace.min.css' }
12+
]
13+
},
14+
loading: { color: '#3B8070' },
15+
build: {
16+
extend (config, ctx) {
17+
if (ctx.dev && ctx.isClient) {
18+
// config.module.rules.push({
19+
// enforce: 'pre',
20+
// test: /\.(js|vue)$/,
21+
// loader: 'eslint-loader',
22+
// exclude: /(node_modules)/
23+
// })
24+
}
25+
}
26+
},
27+
plugins: [
28+
{src: '~/plugins/firebase.js'}
29+
],
30+
css: [
31+
{ src: '~/assets/css/main.css', lang: 'css'},
32+
]
33+
}

package.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "nuxt-lowdb",
3+
"version": "1.0.0",
4+
"description": "Nuxt.js project",
5+
"author": "David Royer <[email protected]>",
6+
"private": true,
7+
"scripts": {
8+
"dev": "nuxt",
9+
"build": "nuxt build",
10+
"start": "nuxt start",
11+
"generate": "nuxt generate",
12+
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
13+
"precommit": "npm run lint",
14+
"fdeploy": "yarn generate && firebase deploy"
15+
},
16+
"dependencies": {
17+
"firebase": "^4.4.0",
18+
"lowdb": "^1.0.0",
19+
"nuxt": "^1.0.0-rc11"
20+
},
21+
"devDependencies": {
22+
"babel-eslint": "^7.2.3",
23+
"eslint": "^4.3.0",
24+
"eslint-config-standard": "^10.2.1",
25+
"eslint-loader": "^1.9.0",
26+
"eslint-plugin-html": "^3.1.1",
27+
"eslint-plugin-import": "^2.7.0",
28+
"eslint-plugin-node": "^5.1.1",
29+
"eslint-plugin-promise": "^3.5.0",
30+
"eslint-plugin-standard": "^3.0.1"
31+
}
32+
}

pages/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# PAGES
2+
3+
This directory contains your Application Views and Routes.
4+
The framework reads all the .vue files inside this directory and create the router of your application.
5+
6+
More information about the usage of this directory in the documentation:
7+
https://nuxtjs.org/guide/routing

pages/admin.vue

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<template>
2+
<section class="container">
3+
<div>
4+
<button @click="logout">Logout</button>
5+
<h1 class="title">
6+
Admin Page Here
7+
</h1>
8+
<nuxt-link to="/">Back To Main Page</nuxt-link>
9+
</div>
10+
</section>
11+
</template>
12+
13+
<script>
14+
15+
export default {
16+
methods: {
17+
logout () {
18+
this.$store.dispatch('userSignOut')
19+
.then(() => {
20+
alert('logged out!')
21+
this.$router.push('/')
22+
})
23+
}
24+
},
25+
middleware: 'auth'
26+
}
27+
</script>
28+
29+
<style>
30+
31+
</style>

pages/index.vue

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<section class="container">
3+
<div>
4+
<h1 class="title">Nuxt Firebase Auth</h1>
5+
<nuxt-link to="/admin">Admin</nuxt-link>
6+
</div>
7+
<login></login>
8+
</section>
9+
</template>
10+
11+
<script>
12+
import Login from '~/components/Login'
13+
14+
export default {
15+
components: {
16+
Login
17+
}
18+
}
19+
</script>

plugins/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# PLUGINS
2+
3+
This directory contains your Javascript plugins that you want to run before instantiating the root vue.js application.
4+
5+
More information about the usage of this directory in the documentation:
6+
https://nuxtjs.org/guide/plugins
7+
8+
**This directory is not required, you can delete it if you don't want to use it.**

0 commit comments

Comments
 (0)