switch between auth views
This commit is contained in:
parent
e193badb13
commit
79b45d4005
3 changed files with 17 additions and 13 deletions
|
|
@ -16,13 +16,13 @@ const routes: Array<RouteRecordRaw> = [
|
||||||
meta: { requiresAuth: true },
|
meta: { requiresAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/register",
|
path: "/login",
|
||||||
name: "login",
|
name: "login",
|
||||||
component: () => import("@/views/login.vue"),
|
component: () => import("@/views/login.vue"),
|
||||||
meta: { requiresAuth: false },
|
meta: { requiresAuth: false },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/login",
|
path: "/register",
|
||||||
name: "register",
|
name: "register",
|
||||||
component: () => import("@/views/register.vue"),
|
component: () => import("@/views/register.vue"),
|
||||||
meta: { requiresAuth: false },
|
meta: { requiresAuth: false },
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<button class="button" @click="submit">Submit</button>
|
<button class="button" @click="submit">Submit</button>
|
||||||
|
|
||||||
<!-- back to login button: position: fixed -->
|
<!-- back to login button: position: fixed -->
|
||||||
<button class="button2" @click="submit">Create an account</button>
|
<button class="button2" @click="switchView">Create an account</button>
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -65,11 +65,16 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const switchView = () => {
|
||||||
|
router.push({ name: "register" });
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
submit,
|
submit,
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
rememberMe
|
rememberMe,
|
||||||
|
switchView
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<button class="button" @click="submit">Submit</button>
|
<button class="button" @click="submit">Submit</button>
|
||||||
|
|
||||||
<!-- back to login button: position: fixed -->
|
<!-- back to login button: position: fixed -->
|
||||||
<button class="button2" @click="submit">Back to login</button>
|
<button class="button2" @click="switchView">Back to login</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -39,10 +39,9 @@ import { useIpc } from "@/modules/ipc";
|
||||||
import { useAuth } from "@/modules/auth";
|
import { useAuth } from "@/modules/auth";
|
||||||
|
|
||||||
interface RegisterPayload {
|
interface RegisterPayload {
|
||||||
|
request?: string;
|
||||||
email?: string;
|
email?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
firstName?: string;
|
|
||||||
lastName?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
|
@ -50,8 +49,6 @@ export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
const email = ref("");
|
const email = ref("");
|
||||||
const password = ref("");
|
const password = ref("");
|
||||||
const firstName = ref("");
|
|
||||||
const lastName = ref("");
|
|
||||||
const rememberMe = ref("");
|
const rememberMe = ref("");
|
||||||
|
|
||||||
const { invoke, data,} = useIpc("auth-user");
|
const { invoke, data,} = useIpc("auth-user");
|
||||||
|
|
@ -59,10 +56,9 @@ export default defineComponent({
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const payload: RegisterPayload = {
|
const payload: RegisterPayload = {
|
||||||
|
request: "register",
|
||||||
email: email.value,
|
email: email.value,
|
||||||
password: password.value,
|
password: password.value,
|
||||||
firstName: firstName.value,
|
|
||||||
lastName: lastName.value,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
|
|
@ -75,11 +71,14 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const switchView = () => {
|
||||||
|
router.push({ name: "login" });
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
firstName,
|
switchView,
|
||||||
lastName,
|
|
||||||
submit,
|
submit,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue