mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(web): use new open api client (#7097)
* refactor(web): use new open api client * refactor: remove activity api * refactor: trash, oauth, and partner apis * refactor: job api * refactor: face, library, system config * refactor: user api * refactor: album api
This commit is contained in:
parent
9b4a770b9d
commit
8fd94211c0
66 changed files with 593 additions and 850 deletions
|
|
@ -1,24 +1,24 @@
|
|||
<script lang="ts">
|
||||
import { api, type UserResponseDto } from '@api';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import Button from '../elements/buttons/button.svelte';
|
||||
import { updateUser, type UserResponseDto } from '@immich/sdk';
|
||||
|
||||
export let user: UserResponseDto;
|
||||
let error: string;
|
||||
let errorMessage: string;
|
||||
let success: string;
|
||||
|
||||
let password = '';
|
||||
let confirmPassowrd = '';
|
||||
let passwordConfirm = '';
|
||||
|
||||
let changeChagePassword = false;
|
||||
let valid = false;
|
||||
|
||||
$: {
|
||||
if (password !== confirmPassowrd && confirmPassowrd.length > 0) {
|
||||
error = 'Password does not match';
|
||||
changeChagePassword = false;
|
||||
if (password !== passwordConfirm && passwordConfirm.length > 0) {
|
||||
errorMessage = 'Password does not match';
|
||||
valid = false;
|
||||
} else {
|
||||
error = '';
|
||||
changeChagePassword = true;
|
||||
errorMessage = '';
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,10 +27,10 @@
|
|||
}>();
|
||||
|
||||
async function changePassword() {
|
||||
if (changeChagePassword) {
|
||||
error = '';
|
||||
if (valid) {
|
||||
errorMessage = '';
|
||||
|
||||
const { status } = await api.userApi.updateUser({
|
||||
await updateUser({
|
||||
updateUserDto: {
|
||||
id: user.id,
|
||||
password: String(password),
|
||||
|
|
@ -38,12 +38,7 @@
|
|||
},
|
||||
});
|
||||
|
||||
if (status === 200) {
|
||||
dispatch('success');
|
||||
return;
|
||||
} else {
|
||||
console.error('Error changing password');
|
||||
}
|
||||
dispatch('success');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -71,12 +66,12 @@
|
|||
type="password"
|
||||
autocomplete="current-password"
|
||||
required
|
||||
bind:value={confirmPassowrd}
|
||||
bind:value={passwordConfirm}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{#if error}
|
||||
<p class="text-sm text-red-400">{error}</p>
|
||||
{#if errorMessage}
|
||||
<p class="text-sm text-red-400">{errorMessage}</p>
|
||||
{/if}
|
||||
|
||||
{#if success}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue