blob: eec0d8f75f9cbd34fe833ba10171dc54b19dbec3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
export const state = () => ({
development: process.env.development,
version: '',
URL: process.env.development ? 'http://localhost:5000' : '/',
baseURL: `${process.env.development ? 'http://localhost:5000' : ''}/api`,
serviceName: '',
maxUploadSize: 0,
chunkSize: 0,
publicMode: false,
userAccounts: false
});
export const actions = {
async fetchSettings({ commit }) {
const response = await this.$axios.$get('service/config');
commit('setSettings', response);
return response;
}
};
export const mutations = {
setSettings(state, { config }) {
state.version = `v${config.version}`;
state.serviceName = config.serviceName;
state.maxUploadSize = config.maxUploadSize;
state.filenameLength = config.filenameLength;
state.albumLinkLength = config.albumLinkLength;
state.chunkSize = config.chunkSize;
state.publicMode = config.publicMode;
state.userAccounts = config.userAccounts;
state.URL = config.domain;
const lastChar = config.domain.substr(-1);
if (lastChar === '/') {
state.baseURL = `${config.domain}api`;
} else {
state.baseURL = `${config.domain}/api`;
}
}
};
|