Skip to content

Commit

Permalink
Adding authorization abort
Browse files Browse the repository at this point in the history
Signed-off-by: Apokalip <simeon@manta.network>
  • Loading branch information
Apokalip committed Aug 22, 2022
1 parent e6d0c41 commit 51e6b3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ui/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ fn main() {
"main" => {
if APP_STATE.get_authorising() {
window(app, "main").hide().expect("Unable to hide window.");
window(app, "main")
.emit("abort_auth", "Aborting Authorization")
.expect("Failed to abort authorization");
} else {
app.exit(0);
}
Expand Down
10 changes: 9 additions & 1 deletion ui/src/pages/Authorize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import { once } from '@tauri-apps/api/event';
import React, { useState, useEffect } from 'react';
import { Button, Header, Input } from 'semantic-ui-react';

const Authorize = ({
Expand All @@ -9,6 +10,13 @@ const Authorize = ({
}) => {
const [password, setPassword] = useState('');
const [passwordInvalid, setPasswordInvalid] = useState(false)
const [abortAuth, setAbortAuth] = useState(false);

useEffect(() => {
once("abort_auth", async () => {
await onClickDecline();
});
});

const onClickAuthorize = async () => {
console.log("[INFO]: Authorizing.");
Expand Down

0 comments on commit 51e6b3a

Please sign in to comment.