From c41078b5b6ce93a7c4fe05ada42c7c8bcf3bf5c3 Mon Sep 17 00:00:00 2001 From: Jeffrey Doyle Date: Mon, 24 Oct 2022 10:42:47 -0700 Subject: [PATCH] Fixes login return issue --- cmds/login.js | 4 +++- cmds/logout.js | 10 +++++++++- cmds/serialize.js | 2 +- cmds/us2.js | 4 ++-- pages/index.js | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/cmds/login.js b/cmds/login.js index e8ae830..5ff5759 100644 --- a/cmds/login.js +++ b/cmds/login.js @@ -1,5 +1,6 @@ import * as fcl from "@onflow/fcl" import { yup, nope, serviceOfType } from "../util" +import { success, fail } from "../util" export const LABEL = "Log In" export const CMD = async () => { @@ -33,5 +34,6 @@ export const CMD = async () => { }) console.log("verified server:", await res.json()) } - return res + + return success(LABEL) } diff --git a/cmds/logout.js b/cmds/logout.js index 6b7d6e3..816caec 100644 --- a/cmds/logout.js +++ b/cmds/logout.js @@ -1,4 +1,12 @@ import { unauthenticate } from "@onflow/fcl" +import { success, fail } from "../util" export const LABEL = "Log Out" -export const CMD = unauthenticate +export const CMD = () => { + try { + unauthenticate() + return success(LABEL) + } catch (e) { + return fail(LABEL) + } +} diff --git a/cmds/serialize.js b/cmds/serialize.js index d87a204..90b8f3d 100644 --- a/cmds/serialize.js +++ b/cmds/serialize.js @@ -4,7 +4,7 @@ import { success, fail } from "../util" export const LABEL = "Serialize" export const CMD = async () => { - const voucher = await fcl + return await fcl .serialize([ fcl.transaction` transaction() { diff --git a/cmds/us2.js b/cmds/us2.js index c084d42..96115d1 100644 --- a/cmds/us2.js +++ b/cmds/us2.js @@ -20,8 +20,8 @@ export const CMD = async () => { return fcl.AppUtils.verifyUserSignatures(MSG, res, { fclCryptoContract, }) - .then(success(LABEL)) - .catch(fail(LABEL)) + .then(() => success(LABEL)) + .catch(() => fail(LABEL)) } catch (error) { console.log(error) return fail(LABEL) diff --git a/pages/index.js b/pages/index.js index 6459e01..d1a60cb 100644 --- a/pages/index.js +++ b/pages/index.js @@ -43,7 +43,7 @@ export default function Home() { return (
-
Status: {status}
+
Status: {status ?? ""}
{services?.map(service => (