aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/basicAuth
diff options
context:
space:
mode:
authorLibravatar Markandan R <rmarkandan@yahoo.com>2021-06-22 10:56:34 +0530
committerLibravatar GitHub <noreply@github.com>2021-06-22 10:56:34 +0530
commita94ed659846f0bc93c05bccf0c96785b91e5c78f (patch)
tree0a50eeb85e9043708936da9a0c923b32edbe8ab9 /src/features/basicAuth
parentDowngraded submodule 'src/internal-server' (diff)
downloadferdium-app-a94ed659846f0bc93c05bccf0c96785b91e5c78f.tar.gz
ferdium-app-a94ed659846f0bc93c05bccf0c96785b91e5c78f.tar.zst
ferdium-app-a94ed659846f0bc93c05bccf0c96785b91e5c78f.zip
Removed the cyclical dependency (#1519) (#1539)
Diffstat (limited to 'src/features/basicAuth')
-rw-r--r--src/features/basicAuth/Component.js2
-rw-r--r--src/features/basicAuth/index.js30
-rw-r--r--src/features/basicAuth/store.js30
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';
17import Form from './Form'; 17import Form from './Form';
18 18
19import styles from './styles'; 19import 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 @@
1import { ipcRenderer } from 'electron'; 1import { ipcRenderer } from 'electron';
2import { observable } from 'mobx';
3 2
4import BasicAuthComponent from './Component'; 3import BasicAuthComponent from './Component';
5 4
6const debug = require('debug')('Ferdi:feature:basicAuth'); 5import { state as ModalState } from './store';
7
8const defaultState = {
9 isModalVisible: true,
10 service: null,
11 authInfo: null,
12};
13 6
14export const state = observable(defaultState); 7const debug = require('debug')('Ferdi:feature:basicAuth');
15 8
16export function resetState() { 9const state = ModalState;
17 Object.assign(state, defaultState);
18}
19 10
20export default function initialize() { 11export 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
43export 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
52export function cancelLogin() {
53 debug('Cancel basic auth event');
54
55 ipcRenderer.send('feature-basic-auth-cancel');
56}
57
58export const Component = BasicAuthComponent; 34export 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 @@
1import { observable } from 'mobx';
2import { ipcRenderer } from 'electron';
3
4const debug = require('debug')('Ferdi:feature:basicAuth');
5
6const defaultState = {
7 isModalVisible: true,
8 service: null,
9 authInfo: null,
10};
11
12export const state = observable(defaultState);
13
14export function resetState() {
15 Object.assign(state, defaultState);
16}
17export 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
26export function cancelLogin() {
27 debug('Cancel basic auth event');
28
29 ipcRenderer.send('feature-basic-auth-cancel');
30}