mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
25 lines
530 B
JavaScript
25 lines
530 B
JavaScript
import { xhrGet } from '../../xhr';
|
|
export const demoMode = {
|
|
state: {
|
|
demoMode: false,
|
|
},
|
|
reducers: {
|
|
setDemoMode: (state, payload) => {
|
|
return {
|
|
...state,
|
|
demoMode: payload.demoMode,
|
|
};
|
|
},
|
|
},
|
|
effects: {
|
|
async getDemoMode() {
|
|
try {
|
|
const response = await xhrGet('/api/demo');
|
|
this.setDemoMode(response.json);
|
|
} catch (Exception) {
|
|
console.error('Error while trying to get resource for api/demo. Error:', Exception);
|
|
}
|
|
},
|
|
},
|
|
};
|