aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/basicAuth/store.ts
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-09-18 11:15:25 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-18 11:15:25 +0200
commitd4101a48b3eee8b1fb177831aa02a4b4fbec2588 (patch)
treec92f2fbe91197fde8589207463d0d6526b4ff76b /src/features/basicAuth/store.ts
parent5.6.3-nightly.6 [skip ci] (diff)
downloadferdium-app-d4101a48b3eee8b1fb177831aa02a4b4fbec2588.tar.gz
ferdium-app-d4101a48b3eee8b1fb177831aa02a4b4fbec2588.tar.zst
ferdium-app-d4101a48b3eee8b1fb177831aa02a4b4fbec2588.zip
chore: convert various files from JS to TS (#1959)
Diffstat (limited to 'src/features/basicAuth/store.ts')
-rw-r--r--src/features/basicAuth/store.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/features/basicAuth/store.ts b/src/features/basicAuth/store.ts
new file mode 100644
index 000000000..0713ff572
--- /dev/null
+++ b/src/features/basicAuth/store.ts
@@ -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}