Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues/passing metaverse url login register #43

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
99 changes: 82 additions & 17 deletions src/components/components/login/MetaverseLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@
-->

<template>
<q-form
@submit="onSubmit"
@reset="onReset"
class="q-gutter-md"
>
<q-form @submit="onSubmit" @reset="onReset" class="q-gutter-md">
<q-input
v-model="username"
filled
label="Username"
hint="Enter your username."
lazy-rules
:rules="[ val => val && val.length > 0 || 'Please enter a username.']"
:rules="[
(val) => (val && val.length > 0) || 'Please enter a username.',
]"
/>

<q-input
Expand All @@ -30,7 +28,9 @@
:type="showPassword ? 'text' : 'password'"
hint="Enter your password."
lazy-rules
:rules="[ val => val && val.length > 0 || 'Please enter a password.']"
:rules="[
(val) => (val && val.length > 0) || 'Please enter a password.',
]"
>
<template v-slot:append>
<q-icon
Expand All @@ -42,33 +42,98 @@
</q-input>

<div align="right">
<q-btn label="Reset" type="reset" color="primary" flat class="q-mr-sm" />
<q-btn label="Login" type="submit" color="primary"/>
<q-btn
label="Reset"
type="reset"
color="primary"
flat
class="q-mr-sm"
/>
<q-btn label="Login" type="submit" color="primary" />
</div>
</q-form>

<q-expansion-item
v-model="metaverseServerSettingExpansion"
expand-icon="language"
label="Advanced"
expand-icon-class="text-red"
header-class="clean-header"
>
<q-card class="no-padding">
<q-card-section class="no-padding">
<q-input
v-model="metaverseServerSetting"
label="Metaverse Server"
>
<template v-slot:before>
<q-icon name="language" size="18px" color="primary" />
</template>

<template v-slot:append>
<q-icon
name="save"
size="18px"
color="primary"
@click="
metaverseServerStore = metaverseServerSetting;
metaverseServerSettingExpansion = false;
"
class="cursor-pointer"
/>
</template>
</q-input>
</q-card-section>
</q-card>
</q-expansion-item>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import { Account } from "@Modules/account";
import { Mutations as StoreMutations } from "@Store/index";
import { Utility } from "@Modules/utility";

export default defineComponent({
name: "MetaverseLogin",

props: ["metaverseUrl"],

emits: ["closeDialog"],

data: () => ({
username: "",
password: "",
showPassword: false
}),
data: function() {
return {
username: "",
password: "",
showPassword: false,
metaverseServerSettingExpansion: false,
metaverseServerSetting: this.$store.state.metaverse.server,
defaultMetaverseServer: this.$store.state.metaverse.server
};
},
computed: {
metaverseServerStore: {
get() {
return this.$store.state.metaverse.server;
},
async set(newValue: string) {
this.$store.commit(StoreMutations.MUTATE, {
property: "metaverse.server",
value: newValue
});
pankaj2k9 marked this conversation as resolved.
Show resolved Hide resolved
await Utility.connectionSetup(
pankaj2k9 marked this conversation as resolved.
Show resolved Hide resolved
this.$store.state.metaverse.server
);
}
}
},

methods: {
async onSubmit() {
try {
const loginResponse = await Account.login(this.username, this.password, this.metaverseUrl);
const loginResponse = await Account.login(
this.username,
this.password,
this.$store.state.metaverse.server
);

if (loginResponse) {
this.$q.notify({
Expand Down
80 changes: 70 additions & 10 deletions src/components/components/login/MetaverseRegister.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,33 +73,93 @@
<q-btn label="Register" type="submit" color="primary"/>
</div>
</q-form>

<q-expansion-item
v-model="metaverseServerSettingExpansion"
expand-icon="language"
label="Advanced"
expand-icon-class="text-red"
header-class="clean-header"
>
<q-card class="no-padding">
<q-card-section class="no-padding">
<q-input
v-model="metaverseServerSetting"
label="Metaverse Server"
>
<template v-slot:before>
<q-icon name="language" size="18px" color="primary" />
</template>

<template v-slot:append>
<q-icon
name="save"
size="18px"
color="primary"
@click="
metaverseServerStore = metaverseServerSetting;
metaverseServerSettingExpansion = false;
"
class="cursor-pointer"
/>
</template>
</q-input>
</q-card-section>
</q-card>
</q-expansion-item>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import { useQuasar } from "quasar";
import { Mutations as StoreMutations } from "@Store/index";
import { Utility } from "@Modules/utility";

import { Account } from "@Modules/account";

export default defineComponent({
name: "MetaverseRegister",

props: ["metaverseUrl"],
data: function() {
return {
username: "",
email: "",
password: "",
confirmPassword: "",
showPassword: false,
showConfirmPassword: false,
metaverseServerSettingExpansion: false,
metaverseServerSetting: this.$store.state.metaverse.server,
defaultMetaverseServer: this.$store.state.metaverse.server
};
},

data: () => ({
username: "",
email: "",
password: "",
confirmPassword: "",
showPassword: false,
showConfirmPassword: false
}),
computed: {
metaverseServerStore: {
get() {
return this.$store.state.metaverse.server;
},
async set(newValue: string) {
this.$store.commit(StoreMutations.MUTATE, {
property: "metaverse.server",
value: newValue
});
pankaj2k9 marked this conversation as resolved.
Show resolved Hide resolved
await Utility.connectionSetup(
pankaj2k9 marked this conversation as resolved.
Show resolved Hide resolved
this.$store.state.metaverse.server
);
}
}
},

methods: {
async onSubmit() {
const $q = useQuasar();
try {
const awaiting = await Account.createAccount(this.username, this.password, this.email, this.metaverseUrl);
await Utility.connectionSetup(
pankaj2k9 marked this conversation as resolved.
Show resolved Hide resolved
this.$store.state.metaverse.server
pankaj2k9 marked this conversation as resolved.
Show resolved Hide resolved
);
const awaiting = await Account.createAccount(this.username, this.password,
this.email, this.$store.state.metaverse.server);
const result = { // TODO: temp to replace code above
data: {
accountWaitingVerification: awaiting
Expand Down
6 changes: 2 additions & 4 deletions src/components/dialogs/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
<q-tab-panels v-model="tab" animated>
<q-tab-panel name="metaverseLogin">
<MetaverseLogin
@closeDialog="$emit('closeDialog', 'close')"
:metaverseUrl="$store.state.metaverse.server"></MetaverseLogin>
@closeDialog="$emit('closeDialog', 'close')"></MetaverseLogin>
</q-tab-panel>

<q-tab-panel name="metaverseRegister">
<MetaverseRegister
@register-success="onMetaverseRegister"
:metaverseUrl="$store.state.metaverse.server"></MetaverseRegister>
@register-success="onMetaverseRegister"></MetaverseRegister>
</q-tab-panel>
</q-tab-panels>
</q-card-section>
Expand Down
1 change: 1 addition & 0 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ export const Store = createStore<IRootState>({
},
// Example action. Any script should be calling the Metavsere component directly
async [Actions.SET_METAVERSE_URL](pContext: ActionContext<IRootState, IRootState>, pUrl: string): Promise<void> {
console.log("pUrl", pUrl);
await MetaverseMgr.ActiveMetaverse.setMetaverseUrl(pUrl);
}
},
Expand Down