Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# e-commerce
# Ecommerce

# Product API Routes

# Cart API Routes

# User API Routes
3 changes: 3 additions & 0 deletions client/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> 1%
last 2 versions
not ie <= 8
7 changes: 7 additions & 0 deletions client/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
17 changes: 17 additions & 0 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/essential',
'@vue/airbnb',
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
parserOptions: {
parser: 'babel-eslint',
},
};
21 changes: 21 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
29 changes: 29 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# client

## Project setup
```
yarn install
```

### Compiles and hot-reloads for development
```
yarn run serve
```

### Compiles and minifies for production
```
yarn run build
```

### Run your tests
```
yarn run test
```

### Lints and fixes files
```
yarn run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
5 changes: 5 additions & 0 deletions client/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app',
],
};
40 changes: 40 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.18.0",
"vue": "^2.6.6",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.4.0",
"@vue/cli-plugin-eslint": "^3.4.0",
"@vue/cli-service": "^3.4.0",
"@vue/eslint-config-airbnb": "^4.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.8.0",
"eslint-plugin-vue": "^5.0.0",
"lint-staged": "^8.1.0",
"vue-template-compiler": "^2.5.21"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.js": [
"vue-cli-service lint",
"git add"
],
"*.vue": [
"vue-cli-service lint",
"git add"
]
}
}
5 changes: 5 additions & 0 deletions client/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {},
},
};
Binary file added client/public/favicon.ico
Binary file not shown.
29 changes: 29 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>client</title>
</head>
<body>
<noscript>
<strong>We're sorry but client doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
</body>
</html>
52 changes: 52 additions & 0 deletions client/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<div id="app">
<Navbar :check-login="signIn" :role="checkRole" />
<router-view/>
</div>
</template>

<script>
import Navbar from '@/components/Navbar.vue';

export default {
name: 'app',
components: {
Navbar,
},
mounted() {
if (localStorage.getItem('token')) {
this.$store.dispatch('checkInStore');
}
},
computed: {
signIn() {
return this.$store.state.isLogin;
},
checkRole() {
return this.$store.state.role;
}
}
}
</script>

<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
}

#nav a {
font-weight: bold;
color: #2c3e50;
}

#nav a.router-link-exact-active {
color: #42b983;
}
</style>
Binary file added client/src/assets/asus.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/assets/msi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/assets/my-commerce.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/assets/razer.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/assets/sample/sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions client/src/components/Navbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<template>
<nav class="navbar navbar-expand-lg navbar-light m-3 border-bottom">
<div class="container d-flex align-self">
<router-link to="/">
<a class="navbar-brand">My-Commerce</a>
</router-link>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item dropdown">
<a
id="subMenu"
class="nav-link dropdown-toggle"
role="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
>Products</a>
<div class="dropdown-menu" aria-labelledby="subMenu">
<router-link to="/products/test">
<a v-if="role == 'admin'" class="dropdown-item">Test Nested Routes</a>
</router-link>
<router-link to="/products">
<a class="dropdown-item" >All Products</a>
</router-link>
</div>
</li>
</ul>
<div v-if="!checkLogin">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<router-link to="/signin">
<button type="button" class="btn btn-light-outline">Signin</button>
</router-link>
</li>
<li class="nav-item signup">
<router-link to="/signup">
<button type="button" class="btn btn-light-outline">
<span style="color: #004be4">Signup</span>
</button>
</router-link>
</li>
</ul>
</div>
<div v-else>
<button @click="signOut" type="button" class="btn btn-sm btn-primary">Signout</button>
</div>
</div>
</div>
</nav>
</template>

<script>
export default {
name: "navbar",
props: ["checkLogin", "role"],
methods: {
signOut() {
localStorage.removeItem("token");
this.$store.commit("signOut", false);
this.$router.push("/");
}
}
};
</script>

<style>
.signup {
border: #004be4 1px solid;
border-radius: 6px;
}
.btn-light-outline {
background-color: transparent;
}
</style>
13 changes: 13 additions & 0 deletions client/src/components/TestNested.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<h1>Test Nested Routes</h1>
</template>

<script>
export default {

}
</script>

<style>

</style>
20 changes: 20 additions & 0 deletions client/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import axios from 'axios';
import VueAlertify from 'vue-alertify';


Vue.prototype.$axios = axios.create({
baseURL: 'http://localhost:3000'
});

Vue.use(VueAlertify);
Vue.config.productionTip = false;

new Vue({
router,
store,
render: h => h(App),
}).$mount('#app');
39 changes: 39 additions & 0 deletions client/src/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import Vue from 'vue';
import Router from 'vue-router';
import Home from './views/Home.vue';

Vue.use(Router);

export default new Router({
mode: 'history',
base: process.env.BASE_URL,
routes: [
{
path: '/',
name: 'home',
component: Home,
},
{
path: '/products',
name: 'products',
component: () => import('@/views/Products.vue'),
children: [
{
path: 'test',
name: 'test',
component: () => import('@/components/TestNested.vue'),
}
]
},
{
path: '/signup',
name: 'Signup',
component: () => import('@/views/Signup.vue'),
},
{
path: '/signin',
name: 'Signin',
component: () => import('@/views/Signin.vue'),
}
],
});
Loading