fix import

This commit is contained in:
SrGooglo 2025-03-25 22:56:10 +00:00
parent 88c06c1f70
commit 4d90a7cc5a

View File

@ -78,7 +78,7 @@ export default class AuthModel {
password, password,
email, email,
accept_tos: tos, accept_tos: tos,
} },
}).catch((error) => { }).catch((error) => {
console.error(error) console.error(error)
@ -108,8 +108,8 @@ export default class AuthModel {
method: "POST", method: "POST",
url: "/auth/token", url: "/auth/token",
data: { data: {
token: token token: token,
} },
}) })
return response.data return response.data
@ -156,7 +156,7 @@ export default class AuthModel {
params: { params: {
username, username,
email, email,
} },
}).catch((error) => { }).catch((error) => {
console.error(error) console.error(error)
@ -169,21 +169,25 @@ export default class AuthModel {
/** /**
* A function to change the user's password. * A function to change the user's password.
* *
* @param {Object} payload - An object containing the currentPassword and newPassword. * @param {Object} payload - An object containing the currentPassword, newPassword, and code.
* @param {string} payload.currentPassword - The current password of the user. * @param {string} payload.currentPassword - The current password of the user.
* @param {string} payload.newPassword - The new password to set for the user. * @param {string} payload.newPassword - The new password to set for the user.
* @param {string} [payload.code] - The activation code sent to the user's email, optional if the old password is provided.
* @return {Promise<Object>} The data response after changing the password. * @return {Promise<Object>} The data response after changing the password.
*/ */
static async changePassword(payload) { static async changePassword(payload) {
const { currentPassword, newPassword } = payload const { currentPassword, newPassword, code, verificationToken } =
payload
const { data } = await request({ const { data } = await request({
method: "put", method: "put",
url: "/auth/password", url: "/auth/password",
data: { data: {
code: code,
verificationToken: verificationToken,
old_password: currentPassword, old_password: currentPassword,
new_password: newPassword, new_password: newPassword,
} },
}) })
return data return data
@ -204,7 +208,7 @@ export default class AuthModel {
data: { data: {
code: code, code: code,
user_id: user_id, user_id: user_id,
} },
}) })
return data return data
@ -223,7 +227,7 @@ export default class AuthModel {
url: "/auth/resend-activation-code", url: "/auth/resend-activation-code",
data: { data: {
user_id: user_id, user_id: user_id,
} },
}) })
return data return data
@ -231,7 +235,9 @@ export default class AuthModel {
static async disableAccount({ confirm = false } = {}) { static async disableAccount({ confirm = false } = {}) {
if (!confirm) { if (!confirm) {
console.error("In order to disable your account, you must confirm the action.") console.error(
"In order to disable your account, you must confirm the action.",
)
return null return null
} }
@ -244,4 +250,16 @@ export default class AuthModel {
return data return data
} }
static async recoverPassword(usernameOrEmail) {
const { data } = await request({
method: "post",
url: "/auth/recover-password",
data: {
account: usernameOrEmail,
},
})
return data
}
} }