Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
K
kiaisoft_tuananh_nuxt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TTS Tran Viet Anh
kiaisoft_tuananh_nuxt
Commits
7528a566
Commit
7528a566
authored
Jan 04, 2023
by
TTS Kieu Tuan Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix indent
parent
10ecac51
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
589 additions
and
313 deletions
+589
-313
Footer.vue
components/Footer.vue
+35
-36
NuxtLogo.vue
components/NuxtLogo.vue
+16
-8
nav.vue
components/nav.vue
+12
-12
navigation.vue
components/navigation.vue
+37
-52
notification.vue
components/notification.vue
+6
-6
sidebar.vue
components/sidebar.vue
+44
-45
stats.js
middleware/stats.js
+5
-5
web.js
middleware/web.js
+3
-3
nuxt.config.js
nuxt.config.js
+54
-63
index.vue
pages/home/index.vue
+13
-13
users.vue
pages/home/users.vue
+294
-0
index.vue
pages/index.vue
+33
-33
register.vue
pages/register.vue
+37
-37
No files found.
components/Footer.vue
View file @
7528a566
<
template
>
<
template
>
<footer
id=
"container"
>
<footer
id=
"container"
>
<div
id=
"contacts"
>
<div
id=
"contacts"
>
<div
id=
"contacts--contact"
>
<div
id=
"contacts--contact"
>
<p>
xavier.seignard+drangies@gmail.com
</p>
<p>
xavier.seignard+drangies@gmail.com
</p>
<p>
+84965615899
</p>
<p>
+84965615899
</p>
</div>
</div>
<div
id=
"contacts--social"
>
<div
id=
"contacts--social"
>
...
@@ -13,49 +12,49 @@
...
@@ -13,49 +12,49 @@
</div>
</div>
</div>
</div>
<div
id=
"mentions"
>
<div
id=
"mentions"
>
<p>
2018 | mentions légales
</p>
<p>
2018 | mentions légales
</p>
</div>
</div>
</footer>
</footer>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
name
:
"
footer
"
,
name
:
"
footer
"
,
};
};
</
script
>
</
script
>
<
style
>
<
style
>
#container
{
#container
{
min-height
:
calc
(
100vh
-
40px
);
min-height
:
calc
(
100vh
-
40px
);
padding-top
:
20px
;
padding-top
:
20px
;
margin-top
:
20px
;
margin-top
:
20px
;
width
:
100vw
;
width
:
100vw
;
color
:
white
;
color
:
white
;
background-color
:
#17a2b8
;
background-color
:
#17a2b8
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
center
;
align-items
:
center
;
}
}
#contacts
{
#contacts
{
display
:
flex
;
display
:
flex
;
justify-content
:
space-around
;
justify-content
:
space-around
;
align-items
:
center
;
align-items
:
center
;
width
:
100%
;
width
:
100%
;
}
}
#contacts--contact
{
#contacts--contact
{
text-align
:
right
;
text-align
:
right
;
}
}
#contacts--social
{
#contacts--social
{
width
:
20%
;
width
:
20%
;
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
}
}
#contacts--social
div
{
#contacts--social
div
{
height
:
30px
;
height
:
30px
;
width
:
30px
;
width
:
30px
;
background-color
:
white
;
background-color
:
white
;
border-radius
:
50%
;
border-radius
:
50%
;
}
}
#mentions
p
{
#mentions
p
{
font-size
:
0.5em
;
font-size
:
0.5em
;
}
}
</
style
>
</
style
>
\ No newline at end of file
components/NuxtLogo.vue
View file @
7528a566
<
template
>
<
template
>
<svg
class=
"nuxt-logo"
viewBox=
"0 0 45 30"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<svg
<path
d=
"M24.7203 29.704H41.1008C41.6211 29.7041 42.1322 29.5669 42.5828 29.3061C43.0334 29.0454 43.4075 28.6704 43.6675 28.2188C43.9275 27.7672 44.0643 27.2549 44.0641 26.7335C44.0639 26.2121 43.9266 25.6999 43.6662 25.2485L32.6655 6.15312C32.4055 5.70162 32.0315 5.32667 31.581 5.06598C31.1305 4.8053 30.6195 4.66805 30.0994 4.66805C29.5792 4.66805 29.0682 4.8053 28.6177 5.06598C28.1672 5.32667 27.7932 5.70162 27.5332 6.15312L24.7203 11.039L19.2208 1.48485C18.9606 1.03338 18.5864 0.658493 18.1358 0.397853C17.6852 0.137213 17.1741 0 16.6538 0C16.1336 0 15.6225 0.137213 15.1719 0.397853C14.7213 0.658493 14.3471 1.03338 14.0868 1.48485L0.397874 25.2485C0.137452 25.6999 0.000226653 26.2121 2.8053e-07 26.7335C-0.000226092 27.2549 0.136554 27.7672 0.396584 28.2188C0.656614 28.6704 1.03072 29.0454 1.48129 29.3061C1.93185 29.5669 2.44298 29.7041 2.96326 29.704H13.2456C17.3195 29.704 20.3239 27.9106 22.3912 24.4118L27.4102 15.7008L30.0986 11.039L38.1667 25.0422H27.4102L24.7203 29.704ZM13.0779 25.0374L5.9022 25.0358L16.6586 6.36589L22.0257 15.7008L18.4322 21.9401C17.0593 24.2103 15.4996 25.0374 13.0779 25.0374Z"
fill=
"#00DC82"
/>
class=
"nuxt-logo"
</svg>
viewBox=
"0 0 45 30"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<path
d=
"M24.7203 29.704H41.1008C41.6211 29.7041 42.1322 29.5669 42.5828 29.3061C43.0334 29.0454 43.4075 28.6704 43.6675 28.2188C43.9275 27.7672 44.0643 27.2549 44.0641 26.7335C44.0639 26.2121 43.9266 25.6999 43.6662 25.2485L32.6655 6.15312C32.4055 5.70162 32.0315 5.32667 31.581 5.06598C31.1305 4.8053 30.6195 4.66805 30.0994 4.66805C29.5792 4.66805 29.0682 4.8053 28.6177 5.06598C28.1672 5.32667 27.7932 5.70162 27.5332 6.15312L24.7203 11.039L19.2208 1.48485C18.9606 1.03338 18.5864 0.658493 18.1358 0.397853C17.6852 0.137213 17.1741 0 16.6538 0C16.1336 0 15.6225 0.137213 15.1719 0.397853C14.7213 0.658493 14.3471 1.03338 14.0868 1.48485L0.397874 25.2485C0.137452 25.6999 0.000226653 26.2121 2.8053e-07 26.7335C-0.000226092 27.2549 0.136554 27.7672 0.396584 28.2188C0.656614 28.6704 1.03072 29.0454 1.48129 29.3061C1.93185 29.5669 2.44298 29.7041 2.96326 29.704H13.2456C17.3195 29.704 20.3239 27.9106 22.3912 24.4118L27.4102 15.7008L30.0986 11.039L38.1667 25.0422H27.4102L24.7203 29.704ZM13.0779 25.0374L5.9022 25.0358L16.6586 6.36589L22.0257 15.7008L18.4322 21.9401C17.0593 24.2103 15.4996 25.0374 13.0779 25.0374Z"
fill=
"#00DC82"
/>
</svg>
</
template
>
</
template
>
<
style
>
<
style
>
.nuxt-logo
{
.nuxt-logo
{
height
:
20%
;
height
:
20%
;
display
:
block
;
display
:
block
;
margin-left
:
auto
;
margin-left
:
auto
;
margin-right
:
auto
;
margin-right
:
auto
;
margin-bottom
:
15px
;
margin-bottom
:
15px
;
}
}
</
style
>
</
style
>
components/nav.vue
View file @
7528a566
...
@@ -37,27 +37,27 @@ export default {
...
@@ -37,27 +37,27 @@ export default {
};
};
</
script
>
</
script
>
<
script
>
<
script
>
import
sidebar
from
"
@/components/sidebar
"
;
import
sidebar
from
"
@/components/sidebar
"
;
import
vuex
from
import
vuex
from
export
default
{
export
default
{
components
:
{
sidebar
},
components
:
{
sidebar
},
};
};
</
script
>
</
script
>
<
script
>
<
script
>
const
token_access
=
localStorage
.
getItem
(
"
token
"
);
const
token_access
=
localStorage
.
getItem
(
"
token
"
);
export
default
{
export
default
{
name
:
"
logout
"
,
name
:
"
logout
"
,
methods
:
{
methods
:
{
logout
()
{
logout
()
{
fetch
(
"
http://127.0.0.1:8000/api/logout
"
,
{
fetch
(
"
http://127.0.0.1:8000/api/logout
"
,
{
method
:
"
POST
"
,
method
:
"
POST
"
,
headers
:
{
headers
:
{
"
Content-Type
"
:
"
application/json
"
,
"
Content-Type
"
:
"
application/json
"
,
accept
:
"
application/json
"
,
"
Accept
"
:
"
application/json
"
,
},
},
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
token
:
this
.
$auth
.
$storage
.
getUniversal
(
"
token
"
),
token
:
this
.
$auth
.
$storage
.
getUniversal
(
"
token
"
),
}),
}),
});
});
localStorage
.
setItem
(
"
token
"
,
""
);
localStorage
.
setItem
(
"
token
"
,
""
);
...
...
components/navigation.vue
View file @
7528a566
<
template
>
<
template
>
<v-card
<v-card
class=
"mx-auto"
height=
"400"
width=
"256"
>
class=
"mx-auto"
<v-navigation-drawer
class=
"deep-purple accent-4"
dark
permanent
>
height=
"400"
<v-list>
width=
"256"
<v-list-item
v-for=
"item in items"
:key=
"item.title"
link
>
>
<v-list-item-icon>
<v-navigation-drawer
<v-icon>
{{
item
.
icon
}}
</v-icon>
class=
"deep-purple accent-4"
</v-list-item-icon>
dark
permanent
<v-list-item-content>
>
<v-list-item-title>
{{
item
.
title
}}
</v-list-item-title>
<v-list>
</v-list-item-content>
<v-list-item
</v-list-item>
v-for=
"item in items"
</v-list>
:key=
"item.title"
link
<template
v-slot:append
>
>
<div
class=
"pa-2"
>
<v-list-item-icon>
<v-btn
block
>
Logout
</v-btn>
<v-icon>
{{
item
.
icon
}}
</v-icon>
</div>
</v-list-item-icon>
</
template
>
</v-navigation-drawer>
<v-list-item-content>
</v-card>
<v-list-item-title>
{{
item
.
title
}}
</v-list-item-title>
</template>
</v-list-item-content>
</v-list-item>
<
script
>
</v-list>
export
default
{
name
:
"
navigation
"
,
<template
v-slot:append
>
data
()
{
<div
class=
"pa-2"
>
return
{
<v-btn
block
>
items
:
[
Logout
{
title
:
"
Dashboard
"
,
icon
:
"
mdi-view-dashboard
"
},
</v-btn>
{
title
:
"
Account
"
,
icon
:
"
mdi-account-box
"
},
</div>
{
title
:
"
Admin
"
,
icon
:
"
mdi-gavel
"
},
</
template
>
],
</v-navigation-drawer>
};
</v-card>
},
};
</template>
</
script
>
<
script
>
export
default
{
name
:
"
navigation
"
,
data
()
{
return
{
items
:
[
{
title
:
'
Dashboard
'
,
icon
:
'
mdi-view-dashboard
'
},
{
title
:
'
Account
'
,
icon
:
'
mdi-account-box
'
},
{
title
:
'
Admin
'
,
icon
:
'
mdi-gavel
'
},
],
}
},
}
</
script
>
components/notification.vue
View file @
7528a566
<
template
>
<
template
>
<div
class=
"notification is-danger bg-danger"
>
<div
class=
"notification is-danger bg-danger"
>
{{
message
}}
{{
message
}}
</div>
</div>
</
template
>
</
template
>
<
style
>
<
style
>
.notification
{
.notification
{
padding
:
11px
;
padding
:
11px
;
margin
:
10px
0px
;
margin
:
10px
0px
;
}
}
</
style
>
</
style
>
<
script
>
<
script
>
export
default
{
export
default
{
name
:
"
Notification
"
,
name
:
"
Notification
"
,
props
:
[
"
message
"
],
props
:
[
"
message
"
],
};
};
</
script
>
</
script
>
components/sidebar.vue
View file @
7528a566
<
template
>
<
template
>
<div>
<div>
<b-button
v-b-toggle
.
sidebar-backdrop
>
More
</b-button>
<b-button
v-b-toggle
.
sidebar-backdrop
>
More
</b-button>
<b-sidebar
<b-sidebar
id=
"sidebar-backdrop"
id=
"sidebar-backdrop"
title=
"Sidebar with backdrop"
title=
"Sidebar with backdrop"
:backdrop-variant=
"variant"
:backdrop-variant=
"variant"
backdrop
backdrop
shadow
shadow
>
>
<div
class=
"px-3 py-2"
>
<div
class=
"px-3 py-2"
>
<b-form-group
label=
"Backdrop variant"
label-for=
"backdrop-variant"
>
<b-form-group
label=
"Backdrop variant"
label-for=
"backdrop-variant"
>
<b-form-select
id=
"backdrop-variant"
v-model=
"variant"
:options=
"variants"
></b-form-select>
<b-form-select
id=
"backdrop-variant"
v-model=
"variant"
:options=
"variants"
></b-form-select>
</b-form-group>
</b-form-group>
</div>
</div>
</b-sidebar>
</b-sidebar>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
name
:
"
sidebar
"
,
name
:
"
sidebar
"
,
};
};
</
script
>
</
script
>
<
script
>
<
script
>
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
variant
:
'
dark
'
,
variant
:
'
dark
'
,
variants
:
[
variants
:
[
'
transparent
'
,
'
transparent
'
,
'
white
'
,
'
white
'
,
'
light
'
,
'
light
'
,
'
dark
'
,
'
dark
'
,
'
primary
'
,
'
primary
'
,
'
secondary
'
,
'
secondary
'
,
'
success
'
,
'
success
'
,
'
danger
'
,
'
danger
'
,
'
warning
'
,
'
warning
'
,
'
info
'
,
'
info
'
,
]
]
}
}
}
}
}
}
</
script
>
</
script
>
\ No newline at end of file
middleware/stats.js
View file @
7528a566
import
http
from
'
http
'
import
http
from
"
http
"
;
export
default
function
({
route
})
{
export
default
function
({
route
})
{
return
http
.
post
(
'
http://my-stats-api.com
'
,
{
return
http
.
post
(
"
http://my-stats-api.com
"
,
{
url
:
route
.
fullPath
url
:
route
.
fullPath
,
})
});
}
}
\ No newline at end of file
middleware/web.js
View file @
7528a566
export
default
({
redirect
})
=>
{
export
default
({
redirect
})
=>
{
// console.log('[LOG]: middleware is running ...')
// console.log('[LOG]: middleware is running ...')
if
(
localStorage
.
getItem
(
"
token
"
)
==
""
)
{
if
(
localStorage
.
getItem
(
"
token
"
)
==
""
)
{
return
redirect
(
'
/
'
)
return
redirect
(
"
/
"
);
}
}
};
};
\ No newline at end of file
nuxt.config.js
View file @
7528a566
export
default
{
export
default
{
// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
ssr
:
false
,
ssr
:
false
,
// Target: https://go.nuxtjs.dev/config-target
// Target: https://go.nuxtjs.dev/config-target
target
:
'
static
'
,
target
:
"
static
"
,
// Global page headers: https://go.nuxtjs.dev/config-head
// Global page headers: https://go.nuxtjs.dev/config-head
head
:
{
head
:
{
title
:
'
KiaiSoft_Tuan_Anh
'
,
title
:
"
KiaiSoft_Tuan_Anh
"
,
htmlAttrs
:
{
htmlAttrs
:
{
lang
:
'
en
'
lang
:
"
en
"
,
},
},
meta
:
[
meta
:
[
{
charset
:
'
utf-8
'
},
{
charset
:
"
utf-8
"
},
{
name
:
'
viewport
'
,
content
:
'
width=device-width, initial-scale=1
'
},
{
name
:
"
viewport
"
,
content
:
"
width=device-width, initial-scale=1
"
},
{
hid
:
'
description
'
,
name
:
'
description
'
,
content
:
''
},
{
hid
:
"
description
"
,
name
:
"
description
"
,
content
:
""
},
{
name
:
'
format-detection
'
,
content
:
'
telephone=no
'
}
{
name
:
"
format-detection
"
,
content
:
"
telephone=no
"
},
],
],
link
:
[
link
:
[{
rel
:
"
icon
"
,
type
:
"
image/x-icon
"
,
href
:
"
/favicon.ico
"
}],
{
rel
:
'
icon
'
,
type
:
'
image/x-icon
'
,
href
:
'
/favicon.ico
'
}
},
]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css
:
[],
// Global CSS: https://go.nuxtjs.dev/config-css
css
:
[
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
],
plugins
:
[],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
// Auto import components: https://go.nuxtjs.dev/config-components
plugins
:
[
components
:
true
,
],
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
// Auto import components: https://go.nuxtjs.dev/config-components
buildModules
:
[
"
@nuxtjs/vuetify
"
],
components
:
true
,
// Modules: https://go.nuxtjs.dev/config-modules
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
modules
:
[
buildModules
:
[
// https://go.nuxtjs.dev/bootstrap
'
@nuxtjs/vuetify
'
,
"
bootstrap-vue/nuxt
"
,
],
"
@nuxtjs/axios
"
,
"
@nuxtjs/auth-next
"
,
// Modules: https://go.nuxtjs.dev/config-modules
],
modules
:
[
axios
:
{
// https://go.nuxtjs.dev/bootstrap
baseURL
:
process
.
env
.
API_URL
||
"
http://127.0.0.1:8000/api/
"
,
'
bootstrap-vue/nuxt
'
,
debug
:
process
.
env
.
DEBUG
||
false
,
'
@nuxtjs/axios
'
,
proxyHeaders
:
false
,
'
@nuxtjs/auth-next
'
,
credentials
:
false
,
],
},
axios
:
{
auth
:
{},
baseURL
:
process
.
env
.
API_URL
||
'
http://127.0.0.1:8000/api/
'
,
debug
:
process
.
env
.
DEBUG
||
false
,
// Build Configuration: https://go.nuxtjs.dev/config-build
proxyHeaders
:
false
,
build
:
{},
credentials
:
false
,
// router: {
},
// middleware: 'web'
auth
:
{
// }
};
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build
:
{
},
// router: {
// middleware: 'web'
// }
}
pages/home/index.vue
View file @
7528a566
<
template
>
<
template
>
<div>
<div>
<div>
<div>
<Nav
/>
<Nav
/>
<h1
style=
"text-align: center"
>
HOME
</h1>
<h1
style=
"text-align: center"
>
HOME
</h1>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
...
@@ -20,10 +20,10 @@ import Nav from "@/components/Nav";
...
@@ -20,10 +20,10 @@ import Nav from "@/components/Nav";
import
Footer
from
"
@/components/footer
"
;
import
Footer
from
"
@/components/footer
"
;
export
default
{
export
default
{
components
:
{
Nav
},
components
:
{
Nav
},
components
:
{
Footer
},
components
:
{
Footer
},
middleware
:
[
'
web
'
],
middleware
:
[
'
web
'
],
};
};
</
script
>
</
script
>
...
...
pages/home/users.vue
0 → 100644
View file @
7528a566
<
template
>
<div>
<div>
<Nav
/>
<h1
style=
"text-align: center"
>
User
</h1>
</div>
<v-data-table
:headers=
"headers"
:items=
"desserts"
sort-by=
"calories"
class=
"elevation-1"
>
<template
v-slot:top
>
<v-toolbar
flat
>
<v-toolbar-title>
My CRUD
</v-toolbar-title>
<v-divider
class=
"mx-4"
inset
vertical
></v-divider>
<v-spacer></v-spacer>
<v-dialog
v-model=
"dialog"
max-width=
"500px"
>
<template
v-slot:activator=
"
{ on, attrs }">
<v-btn
color=
"primary"
dark
class=
"mb-2"
v-bind=
"attrs"
v-on=
"on"
v-on:click=
"getUser"
>
New User
</v-btn>
</
template
>
<v-card>
<v-card-title>
<span
class=
"text-h5"
>
{{ formTitle }}
</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col
cols=
"12"
sm=
"6"
md=
"4"
>
<v-text-field
v-model=
"editedItem.name"
label=
"Dessert name"
></v-text-field>
</v-col>
<v-col
cols=
"12"
sm=
"6"
md=
"4"
>
<v-text-field
v-model=
"editedItem.calories"
label=
"Calories"
></v-text-field>
</v-col>
<v-col
cols=
"12"
sm=
"6"
md=
"4"
>
<v-text-field
v-model=
"editedItem.fat"
label=
"Fat (g)"
></v-text-field>
</v-col>
<v-col
cols=
"12"
sm=
"6"
md=
"4"
>
<v-text-field
v-model=
"editedItem.carbs"
label=
"Carbs (g)"
></v-text-field>
</v-col>
<v-col
cols=
"12"
sm=
"6"
md=
"4"
>
<v-text-field
v-model=
"editedItem.protein"
label=
"Protein (g)"
></v-text-field>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color=
"blue darken-1"
text
@
click=
"close"
>
Cancel
</v-btn>
<v-btn
color=
"blue darken-1"
text
@
click=
"save"
>
Save
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog
v-model=
"dialogDelete"
max-width=
"500px"
>
<v-card>
<v-card-title
class=
"text-h5"
>
Are you sure you want to delete this item?
</v-card-title
>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color=
"blue darken-1"
text
@
click=
"closeDelete"
>
Cancel
</v-btn
>
<v-btn
color=
"blue darken-1"
text
@
click=
"deleteItemConfirm"
>
OK
</v-btn
>
<v-spacer></v-spacer>
</v-card-actions>
</v-card>
</v-dialog>
</v-toolbar>
</template>
<
template
v-slot:item.actions=
"{ item }"
>
<v-icon
small
class=
"mr-2"
@
click=
"editItem(item)"
>
mdi-pencil
</v-icon>
<v-icon
small
@
click=
"deleteItem(item)"
>
mdi-delete
</v-icon>
</
template
>
<
template
v-slot:no-data
>
<v-btn
color=
"primary"
@
click=
"initialize"
>
Reset
</v-btn>
</
template
>
</v-data-table>
</div>
</template>
<
script
>
import
Nav
from
"
@/components/Nav
"
;
import
navigation
from
"
@/components/navigation
"
;
import
axios
from
"
axios
"
;
export
default
{
components
:
{
Nav
},
components
:
{
navigation
},
middleware
:
[
"
web
"
],
data
:
()
=>
({
dialog
:
false
,
dialogDelete
:
false
,
headers
:
[
{
text
:
"
Dessert (100g serving)
"
,
align
:
"
start
"
,
sortable
:
false
,
value
:
"
name
"
,
},
{
text
:
"
Calories
"
,
value
:
"
calories
"
},
{
text
:
"
Fat (g)
"
,
value
:
"
fat
"
},
{
text
:
"
Carbs (g)
"
,
value
:
"
carbs
"
},
{
text
:
"
Protein (g)
"
,
value
:
"
protein
"
},
{
text
:
"
Actions
"
,
value
:
"
actions
"
,
sortable
:
false
},
],
desserts
:
[],
editedIndex
:
-
1
,
editedItem
:
{
name
:
""
,
calories
:
0
,
fat
:
0
,
carbs
:
0
,
protein
:
0
,
},
defaultItem
:
{
name
:
""
,
calories
:
0
,
fat
:
0
,
carbs
:
0
,
protein
:
0
,
},
}),
computed
:
{
formTitle
()
{
return
this
.
editedIndex
===
-
1
?
"
New Item
"
:
"
Edit Item
"
;
},
},
watch
:
{
dialog
(
val
)
{
val
||
this
.
close
();
},
dialogDelete
(
val
)
{
val
||
this
.
closeDelete
();
},
},
created
()
{
this
.
initialize
();
},
methods
:
{
initialize
()
{
this
.
desserts
=
[
{
name
:
"
Frozen Yogurt
"
,
calories
:
159
,
fat
:
6.0
,
carbs
:
24
,
protein
:
4.0
,
},
{
name
:
"
Ice cream sandwich
"
,
calories
:
237
,
fat
:
9.0
,
carbs
:
37
,
protein
:
4.3
,
},
{
name
:
"
Eclair
"
,
calories
:
262
,
fat
:
16.0
,
carbs
:
23
,
protein
:
6.0
,
},
{
name
:
"
Cupcake
"
,
calories
:
305
,
fat
:
3.7
,
carbs
:
67
,
protein
:
4.3
,
},
{
name
:
"
Gingerbread
"
,
calories
:
356
,
fat
:
16.0
,
carbs
:
49
,
protein
:
3.9
,
},
{
name
:
"
Jelly bean
"
,
calories
:
375
,
fat
:
0.0
,
carbs
:
94
,
protein
:
0.0
,
},
{
name
:
"
Lollipop
"
,
calories
:
392
,
fat
:
0.2
,
carbs
:
98
,
protein
:
0
,
},
{
name
:
"
Honeycomb
"
,
calories
:
408
,
fat
:
3.2
,
carbs
:
87
,
protein
:
6.5
,
},
{
name
:
"
Donut
"
,
calories
:
452
,
fat
:
25.0
,
carbs
:
51
,
protein
:
4.9
,
},
{
name
:
"
KitKat
"
,
calories
:
518
,
fat
:
26.0
,
carbs
:
65
,
protein
:
7
,
},
];
},
editItem
(
item
)
{
this
.
editedIndex
=
this
.
desserts
.
indexOf
(
item
);
this
.
editedItem
=
Object
.
assign
({},
item
);
this
.
dialog
=
true
;
},
deleteItem
(
item
)
{
this
.
editedIndex
=
this
.
desserts
.
indexOf
(
item
);
this
.
editedItem
=
Object
.
assign
({},
item
);
this
.
dialogDelete
=
true
;
},
deleteItemConfirm
()
{
this
.
desserts
.
splice
(
this
.
editedIndex
,
1
);
this
.
closeDelete
();
},
close
()
{
this
.
dialog
=
false
;
this
.
$nextTick
(()
=>
{
this
.
editedItem
=
Object
.
assign
({},
this
.
defaultItem
);
this
.
editedIndex
=
-
1
;
});
},
closeDelete
()
{
this
.
dialogDelete
=
false
;
this
.
$nextTick
(()
=>
{
this
.
editedItem
=
Object
.
assign
({},
this
.
defaultItem
);
this
.
editedIndex
=
-
1
;
});
},
save
()
{
if
(
this
.
editedIndex
>
-
1
)
{
Object
.
assign
(
this
.
desserts
[
this
.
editedIndex
],
this
.
editedItem
);
}
else
{
this
.
desserts
.
push
(
this
.
editedItem
);
}
this
.
close
();
},
getUser
()
{
axios
.
get
(
"
http://127.0.0.1:8000/api/users/
"
)
.
then
(
function
(
response
)
{
console
.
log
(
response
);
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
});
},
},
};
</
script
>
pages/index.vue
View file @
7528a566
...
@@ -62,38 +62,38 @@ import Nav from "@/components/Nav";
...
@@ -62,38 +62,38 @@ import Nav from "@/components/Nav";
import
notification
from
"
@/components/notification
"
;
import
notification
from
"
@/components/notification
"
;
export
default
{
export
default
{
components
:
{
Nav
},
components
:
{
Nav
},
components
:
{
notification
},
components
:
{
notification
},
components
:
{
NuxtLogo
},
components
:
{
NuxtLogo
},
};
};
</
script
>
</
script
>
<
script
>
<
script
>
import
{
reactive
}
from
"
vue
"
;
import
{
reactive
}
from
"
vue
"
;
import
axios
from
"
axios
"
;
import
axios
from
"
axios
"
;
export
default
{
export
default
{
data
:
()
=>
{
data
:
()
=>
{
return
{
return
{
email
:
""
,
email
:
""
,
password
:
""
,
password
:
""
,
status
:
null
,
status
:
null
,
error
:
null
,
error
:
null
,
};
};
},
},
methods
:
{
methods
:
{
async
login
()
{
async
login
()
{
try
{
try
{
const
resp
=
await
fetch
(
"
http://127.0.0.1:8000/api/login
"
,
{
const
resp
=
await
fetch
(
"
http://127.0.0.1:8000/api/login
"
,
{
method
:
"
POST
"
,
method
:
"
POST
"
,
headers
:
{
headers
:
{
"
Content-Type
"
:
"
application/json
"
,
"
Content-Type
"
:
"
application/json
"
,
Accept
:
"
application/json
"
,
"
Accept
"
:
"
application/json
"
,
},
},
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
email
:
this
.
email
,
email
:
this
.
email
,
password
:
this
.
password
,
password
:
this
.
password
,
}),
}),
}).
then
((
response
)
=>
{
}).
then
((
response
)
=>
{
return
response
.
json
();
return
response
.
json
();
});
});
console
.
log
(
resp
.
status
);
console
.
log
(
resp
.
status
);
localStorage
.
setItem
(
"
token
"
,
resp
.
data
.
bearer_token
);
localStorage
.
setItem
(
"
token
"
,
resp
.
data
.
bearer_token
);
...
@@ -101,7 +101,7 @@ export default {
...
@@ -101,7 +101,7 @@ export default {
this
.
$auth
.
$storage
.
setUniversal
(
"
userName
"
,
resp
.
data
.
name
);
this
.
$auth
.
$storage
.
setUniversal
(
"
userName
"
,
resp
.
data
.
name
);
this
.
$auth
.
$storage
.
setUniversal
(
"
loggedIn
"
,
"
true
"
);
this
.
$auth
.
$storage
.
setUniversal
(
"
loggedIn
"
,
"
true
"
);
if
(
resp
.
status
==
"
success
"
)
{
if
(
resp
.
status
==
"
success
"
)
{
this
.
$router
.
push
(
"
home
"
);
this
.
$router
.
push
(
"
home
"
);
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
error
=
"
Username or Password not valid
"
;
this
.
error
=
"
Username or Password not valid
"
;
...
@@ -123,34 +123,34 @@ export default {
...
@@ -123,34 +123,34 @@ export default {
// }
// }
},
},
checkForm
:
function
(
e
)
{
checkForm
:
function
(
e
)
{
if
(
this
.
name
&&
this
.
age
)
{
if
(
this
.
name
&&
this
.
age
)
{
return
true
;
return
true
;
}
}
this
.
errors
=
[];
this
.
errors
=
[];
if
(
!
this
.
name
)
{
if
(
!
this
.
name
)
{
this
.
errors
.
push
(
"
Name required.
"
);
this
.
errors
.
push
(
"
Name required.
"
);
}
}
if
(
!
this
.
age
)
{
if
(
!
this
.
age
)
{
this
.
errors
.
push
(
"
Age required.
"
);
this
.
errors
.
push
(
"
Age required.
"
);
}
}
e
.
preventDefault
();
e
.
preventDefault
();
},
},
},
},
};
};
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
#form-login
{
#form-login
{
height
:
50%
;
height
:
50%
;
width
:
25%
;
width
:
25%
;
padding
:
12px
;
padding
:
12px
;
padding-top
:
60px
;
padding-top
:
60px
;
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
background-color
:
white
;
background-color
:
white
;
border-radius
:
3%
;
border-radius
:
3%
;
font-weight
:
600
;
font-weight
:
600
;
}
}
</
style
>
</
style
>
pages/register.vue
View file @
7528a566
...
@@ -63,49 +63,49 @@
...
@@ -63,49 +63,49 @@
import
{
reactive
}
from
"
vue
"
;
import
{
reactive
}
from
"
vue
"
;
export
default
{
export
default
{
data
:
()
=>
{
data
:
()
=>
{
return
{
return
{
name
:
""
,
name
:
""
,
email
:
""
,
email
:
""
,
password
:
""
,
password
:
""
,
confirm_password
:
""
,
confirm_password
:
""
,
};
};
},
},
methods
:
{
methods
:
{
signin
()
{
signin
()
{
fetch
(
"
http://127.0.0.1:8000/api/register
"
,
{
fetch
(
"
http://127.0.0.1:8000/api/register
"
,
{
method
:
"
POST
"
,
method
:
"
POST
"
,
headers
:
{
headers
:
{
"
Content-Type
"
:
"
application/json
"
,
"
Content-Type
"
:
"
application/json
"
,
},
body
:
JSON
.
stringify
({
name
:
this
.
name
,
email
:
this
.
email
,
password
:
this
.
password
,
confirm_password
:
this
.
confirm_password
,
}),
});
this
.
$router
.
push
(
"
/
"
);
},
},
body
:
JSON
.
stringify
({
name
:
this
.
name
,
email
:
this
.
email
,
password
:
this
.
password
,
confirm_password
:
this
.
confirm_password
,
}),
});
this
.
$router
.
push
(
"
/
"
);
},
},
},
};
};
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
#form-logout
{
#form-logout
{
height
:
60%
;
height
:
60%
;
width
:
30%
;
width
:
30%
;
/* border: 1px solid black; */
/* border: 1px solid black; */
padding
:
12px
;
padding
:
12px
;
padding-top
:
30px
;
padding-top
:
30px
;
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
background-color
:
white
;
background-color
:
white
;
border-radius
:
3%
;
border-radius
:
3%
;
font-weight
:
600
;
font-weight
:
600
;
}
}
.btn
{
.btn
{
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
margin-left
:
50px
;
margin-left
:
50px
;
}
}
</
style
>
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment