Skip to content
Snippets Groups Projects
Unverified Commit 5877258d authored by Matiss Janis Aboltins's avatar Matiss Janis Aboltins Committed by GitHub
Browse files

Merge pull request #420 from actualbudget/matiss/test-budget

feat: creating test budget on the config page
parents 16306543 5f437eb5
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { useHistory } from 'react-router-dom';
import { createBudget } from 'loot-core/src/client/actions/budgets';
import { signOut, loggedIn } from 'loot-core/src/client/actions/user';
import { send } from 'loot-core/src/platform/client/fetch';
import {
......@@ -11,6 +12,10 @@ import {
ButtonWithLoading
} from 'loot-design/src/components/common';
import { colors } from 'loot-design/src/style';
import {
isDevelopmentEnvironment,
isPreviewEnvironment
} from 'loot-design/src/util/environment';
import { useServerURL } from '../../hooks/useServerURL';
import { Title, Input } from './subscribe/common';
......@@ -78,6 +83,12 @@ export default function ConfigServer() {
history.push('/');
}
async function onCreateTestFile() {
await send('set-server-url', { url: null });
await dispatch(createBudget({ testMode: true }));
window.__history.push('/');
}
return (
<>
<View style={{ width: 500, marginTop: -30 }}>
......@@ -169,6 +180,16 @@ export default function ConfigServer() {
<Button bare style={{ color: colors.n4 }} onClick={onSkip}>
Don't use a server
</Button>
{(isDevelopmentEnvironment() || isPreviewEnvironment()) && (
<Button
primary
style={{ marginLeft: 15 }}
onClick={onCreateTestFile}
>
Create test file
</Button>
)}
</>
)}
</View>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment