Skip to content

Commit

Permalink
Implement log out
Browse files Browse the repository at this point in the history
  • Loading branch information
ccali11 committed Jun 22, 2023
1 parent 0399f4a commit bc2c27a
Show file tree
Hide file tree
Showing 4 changed files with 1,020 additions and 1,013 deletions.
4 changes: 2 additions & 2 deletions apps/web/src/composables/users.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ref } from 'vue'
import { AddAccountOptions, ProviderString, RemoveAccountOptions, UserWithAccounts, ExistingUserCheck, ApiResponse } from '@casimir/types'
import { AddAccountOptions, ProviderString, RemoveAccountOptions, UserWithAccounts, ApiResponse } from '@casimir/types'
import useEnvironment from '@/composables/environment'
import * as Session from 'supertokens-web-js/recipe/session'

const { usersBaseURL } = useEnvironment()

// 0xd557a5745d4560B24D36A68b52351ffF9c86A212
const session = ref<boolean>(false)
const user = ref<UserWithAccounts>()
const user = ref<UserWithAccounts | null>(null)

export default function useUsers () {

Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/composables/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,22 @@ export default function useWallet() {
// TODO: Implement this for other providers
console.log('Sign up not yet supported for this wallet provider')
}
} catch (error) {
} catch (error: any) {
throw new Error(error.message || 'There was an error logging in')
}
}

async function logout() {
console.log('clicked log out')
loadingUserWallets.value = true
await Session.signOut()
setSelectedAddress('')
setSelectedProvider('')
setSelectedCurrency('')
setUser(undefined)
setUser(null)
setPrimaryAddress('')
loadingUserWallets.value = false
console.log('user.value :>> ', user.value)
// router.push('/auth')
}

Expand Down
7 changes: 6 additions & 1 deletion apps/web/src/layouts/default-layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const termsCheckbox = ref(true)
const {
activeWallets,
userAddresses,
logout,
selectAddress,
selectProvider,
} = useWallet()
Expand Down Expand Up @@ -178,7 +179,11 @@ onUnmounted(() =>{
API
</span>
</button>
<button class="border-t border-[#EAECF0] flex items-center px-[16px] py-[10px] gap-[12px] w-full">
<button
class="border-t border-[#EAECF0] flex items-center px-[16px] py-[10px] gap-[12px] w-full"
:disabled="!user"
@click="logout"
>
<vue-feather
type="log-out"
size="36"
Expand Down
Loading

0 comments on commit bc2c27a

Please sign in to comment.