🐛 Site > Fix crash when current project is destroyed
This commit is contained in:
+2
-5
@@ -103,6 +103,8 @@ class Site
|
|||||||
{
|
{
|
||||||
this.express.use('/', express.static(path.join(__dirname, '../site/dist')))
|
this.express.use('/', express.static(path.join(__dirname, '../site/dist')))
|
||||||
|
|
||||||
|
console.log('/' + _project.slug + '/download')
|
||||||
|
|
||||||
// Project download route
|
// Project download route
|
||||||
this.express.get('/' + _project.slug + '/download', (request, response) =>
|
this.express.get('/' + _project.slug + '/download', (request, response) =>
|
||||||
{
|
{
|
||||||
@@ -122,11 +124,6 @@ class Site
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.express.use('/' + _project.slug + '/files', express.static(_project.path))
|
this.express.use('/' + _project.slug + '/files', express.static(_project.path))
|
||||||
|
|
||||||
this.express.get('/*', (request, response) =>
|
|
||||||
{
|
|
||||||
response.sendFile(path.join(__dirname, '../site/dist/index.html'))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,9 +65,12 @@ export default
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set null file
|
// Reset file
|
||||||
this.$store.commit('setFile', null)
|
this.$store.commit('setFile', null)
|
||||||
|
|
||||||
|
// Reset messages
|
||||||
|
this.$store.commit('emptyMessages', null)
|
||||||
|
|
||||||
// If was connected to another socket
|
// If was connected to another socket
|
||||||
if(this.projectSocket)
|
if(this.projectSocket)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ export default {
|
|||||||
|
|
||||||
mutations:
|
mutations:
|
||||||
{
|
{
|
||||||
|
emptyMessages(state)
|
||||||
|
{
|
||||||
|
state.messages = []
|
||||||
|
},
|
||||||
|
|
||||||
createMessage(state, data)
|
createMessage(state, data)
|
||||||
{
|
{
|
||||||
state.messages.push(data)
|
state.messages.push(data)
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ export default {
|
|||||||
// Current project has been removed
|
// Current project has been removed
|
||||||
if(typeof state.all[state.current.slug] === 'undefined')
|
if(typeof state.all[state.current.slug] === 'undefined')
|
||||||
{
|
{
|
||||||
state.current = null
|
const projectKeys = Object.keys(state.all)
|
||||||
|
state.current = state.all[projectKeys[0]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user