mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
Refactor web to use OpenAPI SDK (#326)
* Refactor main index page * Refactor admin page * Refactor Auth endpoint * Refactor directory to prep for monorepo * Fixed refactoring path * Resolved file path in vite * Refactor photo index page * Refactor thumbnail * Fixed test * Refactor Video Viewer component * Refactor download file * Refactor navigation bar * Refactor upload file check * Simplify Upload Asset signature * PR feedback
This commit is contained in:
parent
7f236c5b18
commit
9a6dfacf9b
55 changed files with 516 additions and 691 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<script context="module" lang="ts">
|
||||
import type { Load } from '@sveltejs/kit';
|
||||
import { getRequest } from '$lib/api';
|
||||
import { api, UserResponseDto } from '@api';
|
||||
|
||||
export const load: Load = async ({ session, fetch }) => {
|
||||
export const load: Load = async ({ session }) => {
|
||||
if (!session.user) {
|
||||
return {
|
||||
status: 302,
|
||||
|
|
@ -10,13 +10,13 @@
|
|||
};
|
||||
}
|
||||
|
||||
const usersOnServer = await getRequest('user', session.user.accessToken);
|
||||
const { data } = await api.userApi.getAllUsers(false);
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
props: {
|
||||
user: session.user,
|
||||
usersOnServer,
|
||||
allUsers: data,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { session } from '$app/stores';
|
||||
|
||||
import type { ImmichUser } from '$lib/models/immich-user';
|
||||
import { AdminSideBarSelection } from '$lib/models/admin-sidebar-selection';
|
||||
|
|
@ -34,12 +33,12 @@
|
|||
import UserManagement from '$lib/components/admin/user-management.svelte';
|
||||
import FullScreenModal from '$lib/components/shared/full-screen-modal.svelte';
|
||||
import CreateUserForm from '$lib/components/forms/create-user-form.svelte';
|
||||
import StatusBox from '../../lib/components/shared/status-box.svelte';
|
||||
import StatusBox from '$lib/components/shared/status-box.svelte';
|
||||
|
||||
let selectedAction: AdminSideBarSelection;
|
||||
|
||||
export let user: ImmichUser;
|
||||
export let usersOnServer: Array<ImmichUser>;
|
||||
export let allUsers: UserResponseDto[];
|
||||
|
||||
let shouldShowCreateUserForm: boolean;
|
||||
|
||||
|
|
@ -52,9 +51,8 @@
|
|||
});
|
||||
|
||||
const onUserCreated = async () => {
|
||||
if ($session.user) {
|
||||
usersOnServer = await getRequest('user', $session.user.accessToken);
|
||||
}
|
||||
const { data } = await api.userApi.getAllUsers(false);
|
||||
allUsers = data;
|
||||
|
||||
shouldShowCreateUserForm = false;
|
||||
};
|
||||
|
|
@ -97,7 +95,7 @@
|
|||
<section id="setting-content" class="relative pt-[85px] flex place-content-center">
|
||||
<section class="w-[800px] pt-4">
|
||||
{#if selectedAction === AdminSideBarSelection.USER_MANAGEMENT}
|
||||
<UserManagement {usersOnServer} on:createUser={() => (shouldShowCreateUserForm = true)} />
|
||||
<UserManagement {allUsers} on:createUser={() => (shouldShowCreateUserForm = true)} />
|
||||
{/if}
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue