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 },
|
||||
},
|
||||
{
|
||||
path: "/register",
|
||||
path: "/login",
|
||||
name: "login",
|
||||
component: () => import("@/views/login.vue"),
|
||||
meta: { requiresAuth: false },
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
path: "/register",
|
||||
name: "register",
|
||||
component: () => import("@/views/register.vue"),
|
||||
meta: { requiresAuth: false },
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<button class="button" @click="submit">Submit</button>
|
||||
|
||||
<!-- 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>
|
||||
</template>
|
||||
|
||||
|
|
@ -65,11 +65,16 @@ export default defineComponent({
|
|||
}
|
||||
};
|
||||
|
||||
const switchView = () => {
|
||||
router.push({ name: "register" });
|
||||
};
|
||||
|
||||
return {
|
||||
submit,
|
||||
email,
|
||||
password,
|
||||
rememberMe
|
||||
rememberMe,
|
||||
switchView
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<button class="button" @click="submit">Submit</button>
|
||||
|
||||
<!-- 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>
|
||||
</template>
|
||||
|
||||
|
|
@ -39,10 +39,9 @@ import { useIpc } from "@/modules/ipc";
|
|||
import { useAuth } from "@/modules/auth";
|
||||
|
||||
interface RegisterPayload {
|
||||
request?: string;
|
||||
email?: string;
|
||||
password?: string;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
|
|
@ -50,8 +49,6 @@ export default defineComponent({
|
|||
setup() {
|
||||
const email = ref("");
|
||||
const password = ref("");
|
||||
const firstName = ref("");
|
||||
const lastName = ref("");
|
||||
const rememberMe = ref("");
|
||||
|
||||
const { invoke, data,} = useIpc("auth-user");
|
||||
|
|
@ -59,10 +56,9 @@ export default defineComponent({
|
|||
const router = useRouter();
|
||||
|
||||
const payload: RegisterPayload = {
|
||||
request: "register",
|
||||
email: email.value,
|
||||
password: password.value,
|
||||
firstName: firstName.value,
|
||||
lastName: lastName.value,
|
||||
};
|
||||
|
||||
const submit = async () => {
|
||||
|
|
@ -75,11 +71,14 @@ export default defineComponent({
|
|||
}
|
||||
};
|
||||
|
||||
const switchView = () => {
|
||||
router.push({ name: "login" });
|
||||
};
|
||||
|
||||
return {
|
||||
email,
|
||||
password,
|
||||
firstName,
|
||||
lastName,
|
||||
switchView,
|
||||
submit,
|
||||
};
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue