diff --git a/.eslintrc.js b/.eslintrc.js index 9538e29..50c37c1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,6 +11,7 @@ module.exports = { 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 'import/extensions': 'off', + 'import/no-cycle': 'off' }, parserOptions: { parser: 'babel-eslint', diff --git a/package-lock.json b/package-lock.json index 53cd280..26018e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2007,6 +2007,43 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, + "axios": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", + "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", + "requires": { + "follow-redirects": "1.5.10", + "is-buffer": "^2.0.2" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "is-buffer": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", + "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -12113,6 +12150,11 @@ } } }, + "vue-fragment": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/vue-fragment/-/vue-fragment-1.5.1.tgz", + "integrity": "sha512-ig6eES6TcMBbANW71ylB+AJgRN+Zksb3f50AxjGpAk6hMzqmeuD80qeh4LJP0jVw2dMBMjgRUfIkrvxygoRgtQ==" + }, "vue-hot-reload-api": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.3.tgz", diff --git a/package.json b/package.json index a51843f..562cb2a 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,13 @@ }, "dependencies": { "@mdi/font": "^3.6.95", + "axios": "^0.19.0", "codemirror": "^5.48.4", "core-js": "^2.6.5", "roboto-fontface": "*", "vue": "^2.6.10", "vue-codemirror": "^4.0.6", + "vue-fragment": "^1.5.1", "vue-router": "^3.0.3", "vuetify": "^2.0.0", "vuex": "^3.0.1", diff --git a/src/App.vue b/src/App.vue index e0de8ed..498f127 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,26 +1,17 @@ - - - Latest Release - - - + + + + + diff --git a/src/components/FormAlerts.vue b/src/components/FormAlerts.vue new file mode 100644 index 0000000..3c284f3 --- /dev/null +++ b/src/components/FormAlerts.vue @@ -0,0 +1,27 @@ + + + + {{ message }} + + + + + + + diff --git a/src/components/FormButtons.vue b/src/components/FormButtons.vue new file mode 100644 index 0000000..40e9d6d --- /dev/null +++ b/src/components/FormButtons.vue @@ -0,0 +1,27 @@ + + + + {{ icon }} + {{ value }} + + + + + + + diff --git a/src/components/FormFields.vue b/src/components/FormFields.vue new file mode 100644 index 0000000..fa46f9c --- /dev/null +++ b/src/components/FormFields.vue @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index 7dca9d2..4aa55bb 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -15,128 +15,19 @@ - Welcome to Vuetify + Welcome to OpenRank - For help and collaboration with other Vuetify developers, + For help and collaboration with other OpenRank developers, please join our online - Discord Community + Discord Community - - - What's next? - - - - {{ next.text }} - - - - - - Important Links - - - - {{ link.text }} - - - - - - Ecosystem - - - - {{ eco.text }} - - - diff --git a/src/components/index.js b/src/components/index.js new file mode 100644 index 0000000..b427d96 --- /dev/null +++ b/src/components/index.js @@ -0,0 +1,5 @@ +export { default as HelloWorld } from './HelloWorld'; +export { default as Card } from './Card'; +export { default as FormAlerts } from './FormAlerts'; +export { default as FormFields } from './FormFields'; +export { default as FormButtons } from './FormButtons'; diff --git a/src/components/layout/Footer.vue b/src/components/layout/Footer.vue index b497fc7..5f66d5f 100644 --- a/src/components/layout/Footer.vue +++ b/src/components/layout/Footer.vue @@ -1,30 +1,32 @@ - - - {{ link }} - - - {{ new Date().getFullYear() }} — Coderplex - - + + + {{ icon }} + + + + + + {{ new Date().getFullYear() }} — OpenRank + + @@ -40,6 +42,33 @@ export default { 'Blog', 'Contact Us', ], + icons: [ + { + icon: 'mdi-youtube', + link: 'https://www.youtube.com/channel/UCTkguToherUvVNnzMFINk-w', + }, + { + icon: 'mdi-facebook', + link: 'https://www.facebook.com/coderplex', + }, + { + icon: 'mdi-github-face', + link: 'https://github.com/coderplex', + }, + { + icon: 'mdi-discord', + link: 'https://discord.gg/qEA8vxd', + }, + { + icon: 'mdi-twitter', + link: 'https://www.twitter.com/coderplex/', + }, + { + icon: 'mdi-instagram', + link: 'https://www.instagram.com/coderplex/', + }, + ], + }), }; diff --git a/src/components/layout/Header.vue b/src/components/layout/Header.vue index 71a678e..6dd5814 100644 --- a/src/components/layout/Header.vue +++ b/src/components/layout/Header.vue @@ -1,10 +1,15 @@ - + Open Rank - + + Login + + + SignUp + diff --git a/src/http.js b/src/http.js new file mode 100644 index 0000000..fce43b3 --- /dev/null +++ b/src/http.js @@ -0,0 +1,7 @@ +import axios from 'axios'; +import store from './store'; + +export default () => axios.create({ + baseURL: store.state.baseUrl, + timeout: 10000, +}); diff --git a/src/main.js b/src/main.js index 5f1d1f1..b854d17 100644 --- a/src/main.js +++ b/src/main.js @@ -1,4 +1,5 @@ import { sync } from 'vuex-router-sync'; +import { Plugin } from 'vue-fragment'; import Vue from 'vue'; import App from './App'; import router from './router'; @@ -9,6 +10,7 @@ import '@mdi/font/css/materialdesignicons.css'; Vue.config.productionTip = false; sync(store, router); +Vue.use(Plugin); new Vue({ router, diff --git a/src/router/index.js b/src/router/index.js index e773ef2..fb69947 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,6 +2,8 @@ import Vue from 'vue'; import Router from 'vue-router'; import Home from '../views/Home'; import About from '../views/About'; +import Register from '../views/Register'; +import Login from '../views/Login'; Vue.use(Router); @@ -19,5 +21,15 @@ export default new Router({ name: 'about', component: About, }, + { + path: '/register', + name: 'register', + component: Register, + }, + { + path: '/login', + name: 'login', + component: Login, + }, ], }); diff --git a/src/store/index.js b/src/store/index.js index 79f9a53..765e4cb 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -3,26 +3,31 @@ import createPersistedState from 'vuex-persistedstate'; import Vue from 'vue'; import Vuex from 'vuex'; +import authentication from './modules/authentication'; + Vue.use(Vuex); const debug = process.env.NODE_ENV !== 'production'; const plugins = debug ? [ createLogger(), - createPersistedState(), + // createPersistedState(), ] : [ createPersistedState(), ]; export default new Vuex.Store({ state: { - + baseUrl: '/api', }, mutations: { }, actions: { + }, + modules: { + authentication, }, plugins, }); diff --git a/src/store/modules/authentication/index.js b/src/store/modules/authentication/index.js new file mode 100644 index 0000000..3a64118 --- /dev/null +++ b/src/store/modules/authentication/index.js @@ -0,0 +1,19 @@ +import register from './register'; +import login from './login'; + +export default { + namespaced: true, + strict: true, + state: { + }, + mutations: { + }, + actions: { + }, + getters: { + }, + modules: { + register, + login, + }, +}; diff --git a/src/store/modules/authentication/login.js b/src/store/modules/authentication/login.js new file mode 100644 index 0000000..fe95a65 --- /dev/null +++ b/src/store/modules/authentication/login.js @@ -0,0 +1,38 @@ +import HTTP from '../../../http'; + +export default { + namespaced: true, + strict: true, + state: { + email: '', + password: '', + successMsg: '', + }, + mutations: { + setEmail(state, email) { + state.email = email; + }, + setPassword(state, password) { + state.password = password; + }, + setSuccessMsg(state, message) { + state.successMsg = message; + }, + }, + actions: { + async login({ + commit, + state: { + email, + password, + }, + }) { + await HTTP().post('/login', { + email, + password, + }).then(({ data: { message } }) => { + commit('setSuccessMsg', message); + }); + }, + }, +}; diff --git a/src/store/modules/authentication/register.js b/src/store/modules/authentication/register.js new file mode 100644 index 0000000..7fec9d9 --- /dev/null +++ b/src/store/modules/authentication/register.js @@ -0,0 +1,51 @@ +import HTTP from '../../../http'; + +export default { + namespaced: true, + strict: true, + state: { + name: '', + email: '', + password: '', + passwordConfirmed: '', + successMsg: '', + }, + mutations: { + setName(state, name) { + state.name = name; + }, + setEmail(state, email) { + state.email = email; + }, + setPassword(state, password) { + state.password = password; + }, + setPasswordConfirmed(state, passwordConfirmed) { + state.passwordConfirmed = passwordConfirmed; + }, + setSuccessMsg(state, message) { + state.successMsg = message; + }, + }, + actions: { + async register({ + commit, + state: { + name, + email, + password, + // eslint-disable-next-line camelcase + passwordConfirmed: password_confirmed, + }, + }) { + await HTTP().post('/users', { + name, + email, + password, + password_confirmed, + }).then(({ data: { message } }) => { + commit('setSuccessMsg', message); + }); + }, + }, +}; diff --git a/src/views/Home.vue b/src/views/Home.vue index 4759554..b39b275 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -3,7 +3,7 @@ + + diff --git a/src/views/Register.vue b/src/views/Register.vue new file mode 100644 index 0000000..b586cdb --- /dev/null +++ b/src/views/Register.vue @@ -0,0 +1,120 @@ + + + + + Register + + + + + + + + + + + + + + + diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..4091ee3 --- /dev/null +++ b/vue.config.js @@ -0,0 +1,12 @@ +module.exports = { + devServer: { + proxy: { + '/api': { + target: 'http://localhost:8000', + headers: { + Connection: 'keep-alive', + }, + }, + }, + }, +};
- For help and collaboration with other Vuetify developers, + For help and collaboration with other OpenRank developers, please join our online - Discord Community + Discord Community