Skip to content

Commit

Permalink
Fixes login return issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyDoyle committed Oct 24, 2022
1 parent 5865bbf commit c41078b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion cmds/login.js
Original file line number Diff line number Diff line change
@@ -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 () => {
Expand Down Expand Up @@ -33,5 +34,6 @@ export const CMD = async () => {
})
console.log("verified server:", await res.json())
}
return res

return success(LABEL)
}
10 changes: 9 additions & 1 deletion cmds/logout.js
Original file line number Diff line number Diff line change
@@ -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)
}
}
2 changes: 1 addition & 1 deletion cmds/serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions cmds/us2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function Home() {
return (
<div>
<ul>{COMMANDS.map(cmd => renderCommand(cmd, setStatus))}</ul>
<pre>Status: {status}</pre>
<pre>Status: {status ?? ""}</pre>
<div>
{services?.map(service => (
<button
Expand All @@ -55,7 +55,7 @@ export default function Home() {
))}
</div>
<div style={{ marginTop: "12px" }}>
<label for="manual-wallet">
<label htmlFor="manual-wallet">
Manually set "discovery.wallet" config:{" "}
</label>
<input ref={discoveryWalletInputRef} name="manual-wallet"></input>
Expand Down

0 comments on commit c41078b

Please sign in to comment.