File tree Expand file tree Collapse file tree 8 files changed +31
-12
lines changed
examples/spa/src/components
firebase/src/core/provider Expand file tree Collapse file tree 8 files changed +31
-12
lines changed Original file line number Diff line number Diff line change 11import { useState } from "react" ;
22import { useFastAuth } from "../hooks/use-fast-auth-relayer" ;
33import Spinner from "./Spinner" ;
4+ import { FastAuthClient } from "@fast-auth/browser-sdk" ;
5+ import { JavascriptProvider } from "@fast-auth/javascript-provider" ;
46
57export function LogoutButton ( ) {
68 const { client } = useFastAuth ( ) ;
@@ -9,7 +11,11 @@ export function LogoutButton() {
911 const handleLogout = async ( ) => {
1012 setIsLoading ( true ) ;
1113 try {
12- await client ?. logout ( ) ;
14+ await ( client as FastAuthClient < JavascriptProvider > ) ?. logout ( {
15+ logoutParams : {
16+ returnTo : window . location . origin ,
17+ }
18+ } ) ;
1319 } finally {
1420 setIsLoading ( false ) ;
1521 }
Original file line number Diff line number Diff line change 11import { SignatureRequest } from "../signer/types" ;
22
3- export interface IFastAuthProvider {
3+ export interface ISignerFastAuthProvider {
44 isLoggedIn ( ) : Promise < boolean > ;
55 requestTransactionSignature ( ...args : any [ ] ) : Promise < void > ;
66 requestDelegateActionSignature ( ...args : any [ ] ) : Promise < void > ;
77 getSignatureRequest ( ) : Promise < SignatureRequest > ;
88 getPath ( ) : Promise < string > ;
99}
10+
11+ export interface IFastAuthProvider extends ISignerFastAuthProvider {
12+ login ( ...args : any [ ] ) : void ;
13+ logout ( ...args : any [ ] ) : void ;
14+ }
Original file line number Diff line number Diff line change 11import { SignatureRequest } from "../signer/types" ;
22
3- export interface IFastAuthProvider {
3+ export interface ISignerFastAuthProvider {
44 isLoggedIn ( ) : Promise < boolean > ;
55 requestTransactionSignature ( ...args : any [ ] ) : Promise < void > ;
66 requestDelegateActionSignature ( ...args : any [ ] ) : Promise < void > ;
77 getSignatureRequest ( ) : Promise < SignatureRequest > ;
88 getPath ( ) : Promise < string > ;
99}
10+
11+ export interface IFastAuthProvider extends ISignerFastAuthProvider {
12+ login ( ...args : any [ ] ) : void ;
13+ logout ( ...args : any [ ] ) : void ;
14+ }
Original file line number Diff line number Diff line change 1- import { Auth0Client } from "@auth0/auth0-spa-js" ;
1+ import { Auth0Client , LogoutOptions } from "@auth0/auth0-spa-js" ;
22import {
33 JavascriptProviderOptions ,
44 JavascriptBaseRequestDelegateActionSignatureOptions ,
@@ -126,9 +126,10 @@ export class JavascriptProvider implements IFastAuthProvider {
126126
127127 /**
128128 * Log out of the client.
129+ * @param options
129130 */
130- async logout ( ) : Promise < void > {
131- await this . client . logout ( ) ;
131+ async logout ( options ?: LogoutOptions ) : Promise < void > {
132+ await this . client . logout ( options ) ;
132133 }
133134
134135 /**
Original file line number Diff line number Diff line change @@ -28,10 +28,11 @@ export class FastAuthClient<P extends IFastAuthProvider = IFastAuthProvider> {
2828
2929 /**
3030 * Log out of the client.
31+ * @param args The arguments for the logout.
3132 * @returns The signature request.
3233 */
33- logout ( ) {
34- return this . provider . logout ( ) ;
34+ logout ( ... args : Parameters < P [ "logout" ] > ) {
35+ return this . provider . logout ( args ) ;
3536 }
3637
3738 /**
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ import { IFastAuthProvider as ISignerFastAuthProvider } from "../../signers/prov
22
33export interface IFastAuthProvider extends ISignerFastAuthProvider {
44 login ( ...args : any [ ] ) : void ;
5- logout ( ) : void ;
5+ logout ( ... args : any [ ] ) : void ;
66}
Original file line number Diff line number Diff line change @@ -34,10 +34,11 @@ export class FastAuthClient<P extends IFastAuthProvider = IFastAuthProvider> {
3434
3535 /**
3636 * Log out of the client.
37+ * @param args The arguments for the logout.
3738 * @returns The signature request.
3839 */
39- logout ( ) {
40- return this . provider . logout ( ) ;
40+ logout ( ... args : Parameters < P [ "logout" ] > [ ] ) {
41+ return this . provider . logout ( args ) ;
4142 }
4243
4344 /**
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ import { IFastAuthProvider as ISignerFastAuthProvider } from "../../signers/prov
22
33export interface IFastAuthProvider extends ISignerFastAuthProvider {
44 login ( ...args : any [ ] ) : void ;
5- logout ( ) : void ;
5+ logout ( ... args : any [ ] ) : void ;
66}
You can’t perform that action at this time.
0 commit comments