Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vuejs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Vlad Golubtsov
vuejs
Commits
94ef6f9f
Commit
94ef6f9f
authored
Jan 29, 2019
by
Vladidas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bugs
parent
ff897493
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
82 additions
and
64 deletions
+82
-64
README.md
README.md
+22
-13
App.vue
public/App.vue
+0
-5
index.js
public/config/index.js
+9
-0
main.js
public/main.js
+4
-3
UserCreate.vue
public/pages/users/UserCreate.vue
+4
-3
UserEdit.vue
public/pages/users/UserEdit.vue
+3
-2
websocket.js
public/services/websocket.js
+33
-19
index.js
public/store/index.js
+7
-6
readme.md
readme.md
+0
-13
No files found.
README.md
View file @
94ef6f9f
# test
> A Vue.js project
#Build project
// Start WebSocket server.
```
php artisan socket:start
```
## Build Setup
// Start Laravel server.
```
php artisan serve
```
```
bash
# install dependencies
npm install
// Start VueJS SPA
```
npm vue dev
```
# serve with hot reload at localhost:8080
npm run dev
##Technologies:
-
Laravel: 5.6.39
-
VueJS: 2.5.22
-
WebSocket: Ratchet
# build for production with minification
npm run build
```
For detailed explanation on how things work, consult the
[
docs for vue-loader
](
http://vuejs.github.io/vue-loader
)
.
/////////////////////
//And keep a smile!//
/////////////////////
```
\ No newline at end of file
public/App.vue
View file @
94ef6f9f
...
...
@@ -29,11 +29,6 @@ export default {
created
()
{
this
.
isAuth
=
store
.
getters
.
isAuth
},
watch
:
{
title
()
{
document
.
title
=
this
.
title
;
}
},
updated
()
{
this
.
isAuth
=
store
.
getters
.
isAuth
...
...
public/config/index.js
0 → 100755
View file @
94ef6f9f
export
default
{
host
:
'http://localhost:8000'
,
wsHost
:
'ws://localhost:8888'
,
redirectIfAuth
:
'/admin/home'
,
redirectIfLogout
:
'/'
,
usersHomePage
:
'/users'
}
\ No newline at end of file
public/main.js
View file @
94ef6f9f
import
Vue
from
'vue'
import
App
from
'./App.vue'
import
Vue
from
'vue'
import
store
from
'./store/index'
import
router
from
'./router/index'
import
App
from
'./App.vue'
new
Vue
({
el
:
'#app'
,
render
:
h
=>
h
(
App
),
store
,
router
});
});
\ No newline at end of file
public/pages/users/UserCreate.vue
View file @
94ef6f9f
...
...
@@ -12,6 +12,7 @@
import
Vue
from
'vue'
;
import
axios
from
'axios'
;
import
UserForm
from
'./UserForm'
;
import
config
from
'./../../config/index'
;
Vue
.
component
(
'user-form'
,
UserForm
);
...
...
@@ -38,10 +39,10 @@ export default {
})
.
then
(
response
=>
{
if
(
response
.
status
===
200
)
{
if
(
response
.
data
.
status
==
1
)
{
this
.
$router
.
push
(
'/users'
)
if
(
!
response
.
data
.
errors
)
{
this
.
$router
.
push
(
config
.
usersHomePage
)
}
else
{
this
.
errors
=
response
.
data
.
errors
this
.
errors
=
response
.
data
.
errors
}
}
});
...
...
public/pages/users/UserEdit.vue
View file @
94ef6f9f
...
...
@@ -10,7 +10,8 @@
</
template
>
<
script
>
import
axios
from
'axios'
import
axios
from
'axios'
import
config
from
'./../../config/index'
;
export
default
{
data
()
{
...
...
@@ -44,7 +45,7 @@ export default {
.
then
(
response
=>
{
if
(
response
.
status
===
200
)
{
if
(
response
.
data
.
status
==
1
)
{
this
.
$router
.
push
(
'/users'
)
this
.
$router
.
push
(
config
.
usersHomePage
)
}
else
{
this
.
errors
=
response
.
data
.
errors
}
...
...
public/services/websocket.js
View file @
94ef6f9f
import
Vue
from
'vue'
/** Start socket. */
const
socket
=
new
WebSocket
(
'ws://localhost:8888'
);
import
Vue
from
"vue"
import
config
from
"./../config/index"
/** Send new message */
const
emitter
=
new
Vue
({
methods
:{
data
:
{
socket
:
null
},
created
()
{
/** Start socket. */
this
.
start
();
/** On message event. */
this
.
onMessage
();
/** On error event. */
this
.
onError
();
},
methods
:
{
send
(
message
){
if
(
1
===
socket
.
readyState
)
socket
.
send
(
message
)
}
if
(
this
.
socket
.
readyState
===
1
)
{
this
.
socket
.
send
(
message
)
}
},
start
(){
this
.
socket
=
new
WebSocket
(
config
.
wsHost
);
},
onMessage
(){
this
.
socket
.
onmessage
=
function
(
msg
){
emitter
.
$emit
(
"message"
,
msg
.
data
)
};
},
onError
(){
this
.
socket
.
onerror
=
function
(
err
){
emitter
.
$emit
(
"error"
,
err
)
};
},
}
});
/** On message event. */
socket
.
onmessage
=
function
(
msg
){
emitter
.
$emit
(
"message"
,
msg
.
data
)
};
/** On error event. */
socket
.
onerror
=
function
(
err
){
emitter
.
$emit
(
"error"
,
err
)
};
export
default
emitter
\ No newline at end of file
public/store/index.js
View file @
94ef6f9f
import
Vue
from
'vue'
import
VueX
from
'vuex'
import
Vue
from
'vue'
import
VueX
from
'vuex'
import
router
from
'./../router'
import
config
from
'./../config/index'
Vue
.
use
(
VueX
);
export
default
new
VueX
.
Store
({
state
:
{
host
:
'http://localhost:8000'
,
// wsHost: 'ws://localhost:8888',
host
:
config
.
host
,
counter
:
0
,
token
:
null
,
},
...
...
@@ -20,7 +20,7 @@ export default new VueX.Store({
localStorage
.
removeItem
(
'user-token'
);
if
(
!
getters
.
isAuth
)
{
return
router
.
push
(
'/'
)
return
router
.
push
(
config
.
redirectIfLogout
)
}
}
},
...
...
@@ -29,7 +29,7 @@ export default new VueX.Store({
state
.
token
=
token
;
localStorage
.
setItem
(
'user-token'
,
token
);
return
router
.
push
(
'/admin/home'
)
return
router
.
push
(
config
.
redirectIfAuth
)
}
},
});
\ No newline at end of file
readme.md
deleted
100755 → 0
View file @
ff897493
// Start WebSocket server.
php artisan socket:start
// Start Laravel server.
php artisan serve
// Start VueJS SPA
npm vue dev
/////////////////////
//And keep a smile!//
/////////////////////
\ No newline at end of file
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