mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
fix(frontend): 🐛 fix login page setup script
This commit is contained in:
parent
b542583303
commit
58f758b6c1
@ -184,34 +184,40 @@
|
|||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, useContext } from "@nuxtjs/composition-api";
|
import { defineComponent, ref, useContext } from "@nuxtjs/composition-api";
|
||||||
import { computed, reactive } from "@vue/reactivity";
|
import { computed, reactive } from "@vue/reactivity";
|
||||||
|
|
||||||
const { $auth } = useContext();
|
|
||||||
|
|
||||||
const form = reactive({
|
|
||||||
email: "changeme@email.com",
|
|
||||||
password: "MyPassword",
|
|
||||||
});
|
|
||||||
|
|
||||||
const loggingIn = ref(false);
|
|
||||||
|
|
||||||
const allowSignup = computed(() => process.env.ALLOW_SIGNUP);
|
|
||||||
|
|
||||||
async function authenticate() {
|
|
||||||
loggingIn.value = true;
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append("username", form.email);
|
|
||||||
formData.append("password", form.password);
|
|
||||||
|
|
||||||
await $auth.loginWith("local", { data: formData });
|
|
||||||
loggingIn.value = false;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
layout: "basic",
|
layout: "basic",
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
const { $auth } = useContext();
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
email: "changeme@email.com",
|
||||||
|
password: "MyPassword",
|
||||||
|
});
|
||||||
|
|
||||||
|
const loggingIn = ref(false);
|
||||||
|
|
||||||
|
const allowSignup = computed(() => process.env.ALLOW_SIGNUP);
|
||||||
|
|
||||||
|
async function authenticate() {
|
||||||
|
loggingIn.value = true;
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("username", form.email);
|
||||||
|
formData.append("password", form.password);
|
||||||
|
|
||||||
|
await $auth.loginWith("local", { data: formData });
|
||||||
|
loggingIn.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
form,
|
||||||
|
loggingIn,
|
||||||
|
allowSignup,
|
||||||
|
authenticate,
|
||||||
|
};
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user