Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Set User #1597

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Daily standups

| | City |
| --------------- | ------------------------------------------------------------------- |
| John Williamson | [Brisbane](https://www.timeanddate.com/worldclock/australia/) |
| Jan Langheimer | [Freiburg](https://www.timeanddate.com/worldclock/germany/freiburg) |
| Ran Cohen | [Tel Aviv](https://www.timeanddate.com/worldclock/israel/tel-aviv) |

Expand Down
22 changes: 12 additions & 10 deletions src/components/layout/Navigation.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
<template>
<div class="container-xl px-0">
<div id="navigation-top" class="d-flex justify-content-end">
<b-btn
@click="loginAction"
:variant="darkMode ? 'outline-dark' : 'outline-light'"
class="block-rounded"
size="sm"
>
<span class="d-none d-sm-inline mr-2">{{ loginButtonLabel }}</span>
<font-awesome-icon :icon="icon" :pulse="spin" fixed-width />
</b-btn>
<b-form-input class="width 800px !important" v-model="user" />
<b-btn @click="setUser"> SetUser </b-btn>
<Notifications />
<settings-menu @showLocaleModal="showLocaleMod" />
<bancor-menu />
Expand All @@ -28,13 +21,22 @@ import { onboard, shortenEthAddress } from "@/api/helpers";
import BaseComponent from "@/components/BaseComponent.vue";
import Notifications from "@/components/compositions/notifications/Notifications.vue";
import ModalLanguageChange from "@/components/modals/ModalLanguageChange.vue";
import { onLogout$ } from "@/api/observables/auth";
import { authenticatedReceiver$ } from "@/api/observables/auth";

@Component({
components: { BancorMenu, SettingsMenu, Notifications, ModalLanguageChange }
})
export default class Navigation extends BaseComponent {
modal: boolean = false;
user: string = "";

setUser() {
vxm.wallet.setUser(this.user);
vxm.ethBancor.onAuthChange(this.user);
vxm.ethWallet.setLoggedInAccount(this.user);
vxm.ethBancor.fetchProtectionPositions();
authenticatedReceiver$.next(this.user);
}

get selectedWallet() {
return vxm.wallet.currentWallet;
Expand Down
9 changes: 8 additions & 1 deletion src/store/modules/wallet/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { createModule, action } from "vuex-class-component";
import { createModule, action, mutation } from "vuex-class-component";
import { vxm, store } from "@/store";

const VuexModule = createModule({
strict: false
});

export class WalletModule extends VuexModule.With({ namespaced: "wallet/" }) {
user = "";

get currentWallet() {
return vxm.bancor.wallet;
}
Expand All @@ -28,10 +30,15 @@ export class WalletModule extends VuexModule.With({ namespaced: "wallet/" }) {
}

get currentUser() {
return this.user;
// @ts-ignore
return vxm[`${vxm.bancor.wallet}Wallet`].currentUser;
}

@mutation setUser(user: string) {
this.user = user;
}

@action async dispatcher(methodName: string, params: any = null) {
return params
? this.$store.dispatch(`${this.currentWallet}/${methodName}`, params)
Expand Down