mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
token request
This commit is contained in:
parent
20379340a2
commit
26d040a6b1
4 changed files with 50 additions and 5 deletions
|
@ -7,6 +7,7 @@ import migration from "./migration";
|
|||
import myUtils from "./upload";
|
||||
import category from "./category";
|
||||
import meta from "./meta";
|
||||
import users from "./users"
|
||||
|
||||
|
||||
export default {
|
||||
|
@ -19,4 +20,5 @@ export default {
|
|||
utils: myUtils,
|
||||
categories: category,
|
||||
meta: meta,
|
||||
users: users
|
||||
};
|
||||
|
|
23
frontend/src/api/users.js
Normal file
23
frontend/src/api/users.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { baseURL } from "./api-utils";
|
||||
import { apiReq } from "./api-utils";
|
||||
const authPrefix = baseURL + "auth/";
|
||||
|
||||
const authURLs = {
|
||||
token: `${authPrefix}token`,
|
||||
};
|
||||
|
||||
// const usersURLs = {
|
||||
|
||||
// }
|
||||
|
||||
export default {
|
||||
async login(formData) {
|
||||
let response = await apiReq.post(authURLs.token, formData, {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
return response.data;
|
||||
},
|
||||
};
|
|
@ -32,7 +32,9 @@
|
|||
light="light"
|
||||
prepend-icon="mdi-lock"
|
||||
:label="$t('login.password')"
|
||||
type="password"
|
||||
:type="showPassword ? 'text' : 'password'"
|
||||
:append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'"
|
||||
@click:append="showPassword = !showPassword"
|
||||
></v-text-field>
|
||||
<v-checkbox
|
||||
class="mb-2 mt-0"
|
||||
|
@ -84,6 +86,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
showLogin: false,
|
||||
showPassword: false,
|
||||
user: {
|
||||
email: "",
|
||||
password: "",
|
||||
|
@ -98,7 +101,10 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
async login() {
|
||||
let key = await api.login(this.user.email, this.user.password);
|
||||
let formData = new FormData();
|
||||
formData.append("username", this.user.email);
|
||||
formData.append("password", this.user.password);
|
||||
let key = await api.users.login(formData);
|
||||
console.log(key);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,10 +2,19 @@
|
|||
<div class="text-center">
|
||||
<v-dialog v-model="addRecipe" width="650" @click:outside="reset">
|
||||
<v-card :loading="processing">
|
||||
<v-app-bar dark color="primary mb-2">
|
||||
<v-icon large left>
|
||||
<v-app-bar dark color="primary mb-2">
|
||||
<v-icon large left v-if="!processing">
|
||||
mdi-link
|
||||
</v-icon>
|
||||
<v-progress-circular
|
||||
v-else
|
||||
indeterminate
|
||||
color="white"
|
||||
large
|
||||
class="mr-2"
|
||||
>
|
||||
</v-progress-circular>
|
||||
|
||||
<v-toolbar-title class="headline">
|
||||
{{ $t("new-recipe.from-url") }}
|
||||
</v-toolbar-title>
|
||||
|
@ -40,7 +49,12 @@
|
|||
<v-btn color="grey" text @click="reset">
|
||||
{{ $t("general.close") }}
|
||||
</v-btn>
|
||||
<v-btn color="success" text @click="createRecipe">
|
||||
<v-btn
|
||||
color="success"
|
||||
text
|
||||
@click="createRecipe"
|
||||
:loading="processing"
|
||||
>
|
||||
{{ $t("general.submit") }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue