-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from DIMO-Network/moiz/logout
Logout Support, Use Types, Cleanup Label
- Loading branch information
Showing
11 changed files
with
229 additions
and
200 deletions.
There are no files selected for viewing
Binary file modified
BIN
+915 Bytes
(100%)
example-dimo-auth/dimo-network-login-with-dimo-0.0.10.tgz
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { | ||
clearSessionData, | ||
storeEmailInLocalStorage, | ||
storeJWTInCookies, | ||
storeWalletAddressInLocalStorage, | ||
} from "../storage/storageManager"; | ||
|
||
export const processAuthResponse = ( | ||
{ token, walletAddress, email }: any, | ||
setAuthenticated: (status: boolean) => void, | ||
onSuccess: (data: { | ||
token: string; | ||
transactionHash?: string; | ||
transactionReceipt?: any; | ||
}) => void | ||
) => { | ||
if (walletAddress) storeWalletAddressInLocalStorage(walletAddress); | ||
if (email) storeEmailInLocalStorage(email); | ||
if (token) { | ||
storeJWTInCookies(token); | ||
setAuthenticated(true); | ||
onSuccess({ token }); | ||
} | ||
}; | ||
|
||
export const logout = (setAuthenticated: (status: boolean) => void) => { | ||
clearSessionData(); | ||
setAuthenticated(false); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters