blob: 0fc2899166c2541c77860406dbb2cd193666a0a1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import { observable } from 'mobx';
import { ipcRenderer } from 'electron';
const debug = require('../../preload-safe-debug')('Ferdium:feature:basicAuth');
interface IAuthInfo {
host: string;
port: number;
}
interface IDefaultState {
isModalVisible: boolean;
service: null;
authInfo: IAuthInfo | null;
}
const defaultState: IDefaultState = {
isModalVisible: true,
service: null,
authInfo: null,
};
export const state = observable(defaultState);
export function resetState() {
Object.assign(state, defaultState);
}
export function sendCredentials(user, password) {
debug('Sending credentials to main', user, password);
ipcRenderer.send('feature-basic-auth-credentials', {
user,
password,
});
}
export function cancelLogin() {
debug('Cancel basic auth event');
ipcRenderer.send('feature-basic-auth-cancel');
}
|