diff options
author | 2021-06-22 10:56:34 +0530 | |
---|---|---|
committer | 2021-06-22 10:56:34 +0530 | |
commit | a94ed659846f0bc93c05bccf0c96785b91e5c78f (patch) | |
tree | 0a50eeb85e9043708936da9a0c923b32edbe8ab9 /src/features/basicAuth | |
parent | Downgraded submodule 'src/internal-server' (diff) | |
download | ferdium-app-a94ed659846f0bc93c05bccf0c96785b91e5c78f.tar.gz ferdium-app-a94ed659846f0bc93c05bccf0c96785b91e5c78f.tar.zst ferdium-app-a94ed659846f0bc93c05bccf0c96785b91e5c78f.zip |
Diffstat (limited to 'src/features/basicAuth')
-rw-r--r-- | src/features/basicAuth/Component.js | 2 | ||||
-rw-r--r-- | src/features/basicAuth/index.js | 30 | ||||
-rw-r--r-- | src/features/basicAuth/store.js | 30 |
3 files changed, 34 insertions, 28 deletions
diff --git a/src/features/basicAuth/Component.js b/src/features/basicAuth/Component.js index ba9ae2273..14184f80b 100644 --- a/src/features/basicAuth/Component.js +++ b/src/features/basicAuth/Component.js | |||
@@ -13,7 +13,7 @@ import { | |||
13 | resetState, | 13 | resetState, |
14 | sendCredentials, | 14 | sendCredentials, |
15 | cancelLogin, | 15 | cancelLogin, |
16 | } from '.'; | 16 | } from './store'; |
17 | import Form from './Form'; | 17 | import Form from './Form'; |
18 | 18 | ||
19 | import styles from './styles'; | 19 | import styles from './styles'; |
diff --git a/src/features/basicAuth/index.js b/src/features/basicAuth/index.js index 51625ea55..e43d51d15 100644 --- a/src/features/basicAuth/index.js +++ b/src/features/basicAuth/index.js | |||
@@ -1,21 +1,12 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | import { observable } from 'mobx'; | ||
3 | 2 | ||
4 | import BasicAuthComponent from './Component'; | 3 | import BasicAuthComponent from './Component'; |
5 | 4 | ||
6 | const debug = require('debug')('Ferdi:feature:basicAuth'); | 5 | import { state as ModalState } from './store'; |
7 | |||
8 | const defaultState = { | ||
9 | isModalVisible: true, | ||
10 | service: null, | ||
11 | authInfo: null, | ||
12 | }; | ||
13 | 6 | ||
14 | export const state = observable(defaultState); | 7 | const debug = require('debug')('Ferdi:feature:basicAuth'); |
15 | 8 | ||
16 | export function resetState() { | 9 | const state = ModalState; |
17 | Object.assign(state, defaultState); | ||
18 | } | ||
19 | 10 | ||
20 | export default function initialize() { | 11 | export default function initialize() { |
21 | debug('Initialize basicAuth feature'); | 12 | debug('Initialize basicAuth feature'); |
@@ -40,19 +31,4 @@ export function mainIpcHandler(mainWindow, authInfo) { | |||
40 | }); | 31 | }); |
41 | } | 32 | } |
42 | 33 | ||
43 | export function sendCredentials(user, password) { | ||
44 | debug('Sending credentials to main', user, password); | ||
45 | |||
46 | ipcRenderer.send('feature-basic-auth-credentials', { | ||
47 | user, | ||
48 | password, | ||
49 | }); | ||
50 | } | ||
51 | |||
52 | export function cancelLogin() { | ||
53 | debug('Cancel basic auth event'); | ||
54 | |||
55 | ipcRenderer.send('feature-basic-auth-cancel'); | ||
56 | } | ||
57 | |||
58 | export const Component = BasicAuthComponent; | 34 | export const Component = BasicAuthComponent; |
diff --git a/src/features/basicAuth/store.js b/src/features/basicAuth/store.js new file mode 100644 index 000000000..0713ff572 --- /dev/null +++ b/src/features/basicAuth/store.js | |||
@@ -0,0 +1,30 @@ | |||
1 | import { observable } from 'mobx'; | ||
2 | import { ipcRenderer } from 'electron'; | ||
3 | |||
4 | const debug = require('debug')('Ferdi:feature:basicAuth'); | ||
5 | |||
6 | const defaultState = { | ||
7 | isModalVisible: true, | ||
8 | service: null, | ||
9 | authInfo: null, | ||
10 | }; | ||
11 | |||
12 | export const state = observable(defaultState); | ||
13 | |||
14 | export function resetState() { | ||
15 | Object.assign(state, defaultState); | ||
16 | } | ||
17 | export function sendCredentials(user, password) { | ||
18 | debug('Sending credentials to main', user, password); | ||
19 | |||
20 | ipcRenderer.send('feature-basic-auth-credentials', { | ||
21 | user, | ||
22 | password, | ||
23 | }); | ||
24 | } | ||
25 | |||
26 | export function cancelLogin() { | ||
27 | debug('Cancel basic auth event'); | ||
28 | |||
29 | ipcRenderer.send('feature-basic-auth-cancel'); | ||
30 | } | ||