2018-01-30 20:15:09 +00:00
|
|
|
const preview = require('../pages/preview');
|
2018-07-31 18:09:18 +00:00
|
|
|
const password = require('../pages/password');
|
2017-08-24 21:54:02 +00:00
|
|
|
|
|
|
|
module.exports = function(state, emit) {
|
2018-01-24 18:23:13 +00:00
|
|
|
if (!state.fileInfo) {
|
2018-07-31 18:09:18 +00:00
|
|
|
emit('getPasswordExist', { id: state.params.id });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
state.fileInfo.id = state.params.id;
|
|
|
|
state.fileInfo.secretKey = state.params.key;
|
2018-01-24 18:23:13 +00:00
|
|
|
|
2018-07-31 18:09:18 +00:00
|
|
|
if (!state.transfer && !state.fileInfo.requiresPassword) {
|
|
|
|
emit('getMetadata');
|
2018-01-24 18:23:13 +00:00
|
|
|
}
|
|
|
|
|
2017-08-24 21:54:02 +00:00
|
|
|
if (state.transfer) {
|
2018-07-31 18:09:18 +00:00
|
|
|
return preview(state, emit);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state.fileInfo.requiresPassword && !state.fileInfo.password) {
|
|
|
|
return password(state, emit);
|
2017-08-24 21:54:02 +00:00
|
|
|
}
|
|
|
|
};
|