Use new path of change_password API method
This commit is contained in:
parent
f5a5263725
commit
f939d9ff9a
3 changed files with 20 additions and 20 deletions
|
@ -1,5 +1,24 @@
|
|||
import { BACKEND_URL } from "@/constants"
|
||||
import { http } from "./common"
|
||||
import { User } from "./users"
|
||||
|
||||
export async function changePassword(
|
||||
authToken: string,
|
||||
newPassword: string,
|
||||
): Promise<User> {
|
||||
const url = `${BACKEND_URL}/api/v1/settings/change_password`
|
||||
const response = await http(url, {
|
||||
method: "POST",
|
||||
json: { new_password: newPassword },
|
||||
authToken,
|
||||
})
|
||||
const data = await response.json()
|
||||
if (response.status !== 200) {
|
||||
throw new Error(data.message)
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadBlob(blob: Blob) {
|
||||
const fileUrl = window.URL.createObjectURL(blob)
|
||||
|
|
|
@ -240,24 +240,6 @@ export async function updateProfile(
|
|||
}
|
||||
}
|
||||
|
||||
export async function changePassword(
|
||||
authToken: string,
|
||||
newPassword: string,
|
||||
): Promise<User> {
|
||||
const url = `${BACKEND_URL}/api/v1/accounts/change_password`
|
||||
const response = await http(url, {
|
||||
method: "POST",
|
||||
json: { new_password: newPassword },
|
||||
authToken,
|
||||
})
|
||||
const data = await response.json()
|
||||
if (response.status !== 200) {
|
||||
throw new Error(data.message)
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
interface UnsignedActivity {
|
||||
internal_activity_id: string,
|
||||
activity: string,
|
||||
|
|
|
@ -60,8 +60,7 @@
|
|||
<script setup lang="ts">
|
||||
import { $, $ref } from "vue/macros"
|
||||
|
||||
import { exportFollowers, exportFollows } from "@/api/settings"
|
||||
import { changePassword } from "@/api/users"
|
||||
import { changePassword, exportFollowers, exportFollows } from "@/api/settings"
|
||||
import SidebarLayout from "@/components/SidebarLayout.vue"
|
||||
import { useCurrentUser } from "@/store/user"
|
||||
|
||||
|
|
Loading…
Reference in a new issue