aboutsummaryrefslogtreecommitdiffstats
path: root/packages/renderer/src/stores/Service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/renderer/src/stores/Service.ts')
-rw-r--r--packages/renderer/src/stores/Service.ts84
1 files changed, 48 insertions, 36 deletions
diff --git a/packages/renderer/src/stores/Service.ts b/packages/renderer/src/stores/Service.ts
index 7878ea0..695cff4 100644
--- a/packages/renderer/src/stores/Service.ts
+++ b/packages/renderer/src/stores/Service.ts
@@ -25,47 +25,59 @@ import getEnv from '../env/getEnv';
25 25
26import ServiceSettings from './ServiceSettings'; 26import ServiceSettings from './ServiceSettings';
27 27
28const Service = defineServiceModel(ServiceSettings).actions((self) => ({ 28const Service = defineServiceModel(ServiceSettings).actions((self) => {
29 dispatch(serviceAction: ServiceAction): void { 29 function dispatch(serviceAction: ServiceAction): void {
30 getEnv(self).dispatchMainAction({ 30 getEnv(self).dispatchMainAction({
31 action: 'dispatch-service-action', 31 action: 'dispatch-service-action',
32 serviceId: self.id, 32 serviceId: self.id,
33 serviceAction, 33 serviceAction,
34 }); 34 });
35 }, 35 }
36 goBack(): void { 36
37 this.dispatch({ 37 return {
38 action: 'back', 38 goBack(): void {
39 }); 39 dispatch({
40 }, 40 action: 'back',
41 goForward(): void { 41 });
42 this.dispatch({ 42 },
43 action: 'forward', 43 goForward(): void {
44 }); 44 dispatch({
45 }, 45 action: 'forward',
46 reload(ignoreCache = false): void { 46 });
47 this.dispatch({ 47 },
48 action: 'reload', 48 reload(ignoreCache = false): void {
49 ignoreCache, 49 dispatch({
50 }); 50 action: 'reload',
51 }, 51 ignoreCache,
52 stop(): void { 52 });
53 this.dispatch({ 53 },
54 action: 'stop', 54 stop(): void {
55 }); 55 dispatch({
56 }, 56 action: 'stop',
57 go(url: string): void { 57 });
58 this.dispatch({ 58 },
59 action: 'go', 59 go(url: string): void {
60 url, 60 dispatch({
61 }); 61 action: 'go',
62 }, 62 url,
63 goHome(): void { 63 });
64 this.dispatch({ 64 },
65 action: 'go-home', 65 goHome(): void {
66 }); 66 dispatch({
67 }, 67 action: 'go-home',
68})); 68 });
69 },
70 temporarilyTrustCurrentCertificate(): void {
71 if (self.state.type !== 'certificateError') {
72 throw new Error('No certificate to accept');
73 }
74 dispatch({
75 action: 'temporarily-trust-current-certificate',
76 fingerprint: self.state.certificate.fingerprint,
77 });
78 },
79 };
80});
69 81
70/* 82/*
71 eslint-disable-next-line @typescript-eslint/no-redeclare -- 83 eslint-disable-next-line @typescript-eslint/no-redeclare --