chore(web): prettier (#2821)

Co-authored-by: Thomas Way <thomas@6f.io>
This commit is contained in:
Jason Rasmussen
2023-07-01 00:50:47 -04:00
committed by GitHub
parent 7c2f7d6c51
commit f55b3add80
242 changed files with 12794 additions and 13426 deletions

View File

@@ -3,16 +3,16 @@ import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
export const load = (async ({ locals: { user } }) => {
if (!user) {
throw redirect(302, AppRoute.AUTH_LOGIN);
} else if (!user.shouldChangePassword) {
throw redirect(302, AppRoute.PHOTOS);
}
if (!user) {
throw redirect(302, AppRoute.AUTH_LOGIN);
} else if (!user.shouldChangePassword) {
throw redirect(302, AppRoute.PHOTOS);
}
return {
user,
meta: {
title: 'Change Password'
}
};
return {
user,
meta: {
title: 'Change Password',
},
};
}) satisfies PageServerLoad;

View File

@@ -1,28 +1,28 @@
<script lang="ts">
import { goto } from '$app/navigation';
import ChangePasswordForm from '$lib/components/forms/change-password-form.svelte';
import FullscreenContainer from '$lib/components/shared-components/fullscreen-container.svelte';
import { AppRoute } from '$lib/constants';
import type { PageData } from './$types';
import { goto } from '$app/navigation';
import ChangePasswordForm from '$lib/components/forms/change-password-form.svelte';
import FullscreenContainer from '$lib/components/shared-components/fullscreen-container.svelte';
import { AppRoute } from '$lib/constants';
import type { PageData } from './$types';
export let data: PageData;
export let data: PageData;
const onSuccessHandler = async () => {
await fetch(AppRoute.AUTH_LOGOUT, { method: 'POST' });
const onSuccessHandler = async () => {
await fetch(AppRoute.AUTH_LOGOUT, { method: 'POST' });
goto(AppRoute.AUTH_LOGIN);
};
goto(AppRoute.AUTH_LOGIN);
};
</script>
<FullscreenContainer title={data.meta.title}>
<p slot="message">
Hi {data.user.firstName}
{data.user.lastName} ({data.user.email}),
<br />
<br />
This is either the first time you are signing into the system or a request has been made to change
your password. Please enter the new password below.
</p>
<p slot="message">
Hi {data.user.firstName}
{data.user.lastName} ({data.user.email}),
<br />
<br />
This is either the first time you are signing into the system or a request has been made to change your password. Please
enter the new password below.
</p>
<ChangePasswordForm user={data.user} on:success={onSuccessHandler} />
<ChangePasswordForm user={data.user} on:success={onSuccessHandler} />
</FullscreenContainer>

View File

@@ -1,34 +1,34 @@
import { AppRoute } from '$lib/constants';
import { redirect } from '@sveltejs/kit';
import type { OAuthConfigResponseDto } from '@api';
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
export const load = (async ({ locals: { api } }) => {
const { data } = await api.userApi.getUserCount({ admin: true });
if (data.userCount === 0) {
// Admin not registered
throw redirect(302, AppRoute.AUTH_REGISTER);
}
const { data } = await api.userApi.getUserCount({ admin: true });
if (data.userCount === 0) {
// Admin not registered
throw redirect(302, AppRoute.AUTH_REGISTER);
}
let authConfig: OAuthConfigResponseDto = {
passwordLoginEnabled: true,
enabled: false
};
let authConfig: OAuthConfigResponseDto = {
passwordLoginEnabled: true,
enabled: false,
};
try {
// TODO: Figure out how to get correct redirect URI server-side.
const { data } = await api.oauthApi.generateConfig({ oAuthConfigDto: { redirectUri: '/' } });
data.url = undefined;
try {
// TODO: Figure out how to get correct redirect URI server-side.
const { data } = await api.oauthApi.generateConfig({ oAuthConfigDto: { redirectUri: '/' } });
data.url = undefined;
authConfig = data;
} catch (err) {
console.error('[ERROR] login/+page.server.ts:', err);
}
authConfig = data;
} catch (err) {
console.error('[ERROR] login/+page.server.ts:', err);
}
return {
authConfig,
meta: {
title: 'Login'
}
};
return {
authConfig,
meta: {
title: 'Login',
},
};
}) satisfies PageServerLoad;

View File

@@ -1,23 +1,23 @@
<script lang="ts">
import { goto } from '$app/navigation';
import LoginForm from '$lib/components/forms/login-form.svelte';
import FullscreenContainer from '$lib/components/shared-components/fullscreen-container.svelte';
import { AppRoute } from '$lib/constants';
import { loginPageMessage } from '$lib/constants';
import type { PageData } from './$types';
import { goto } from '$app/navigation';
import LoginForm from '$lib/components/forms/login-form.svelte';
import FullscreenContainer from '$lib/components/shared-components/fullscreen-container.svelte';
import { AppRoute } from '$lib/constants';
import { loginPageMessage } from '$lib/constants';
import type { PageData } from './$types';
export let data: PageData;
export let data: PageData;
</script>
<FullscreenContainer title={data.meta.title} showMessage={!!loginPageMessage}>
<p slot="message">
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html loginPageMessage}
</p>
<p slot="message">
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html loginPageMessage}
</p>
<LoginForm
authConfig={data.authConfig}
on:success={() => goto(AppRoute.PHOTOS, { invalidateAll: true })}
on:first-login={() => goto(AppRoute.AUTH_CHANGE_PASSWORD)}
/>
<LoginForm
authConfig={data.authConfig}
on:success={() => goto(AppRoute.PHOTOS, { invalidateAll: true })}
on:first-login={() => goto(AppRoute.AUTH_CHANGE_PASSWORD)}
/>
</FullscreenContainer>

View File

@@ -1,12 +1,12 @@
import { json } from '@sveltejs/kit';
import { api } from '@api';
import type { RequestHandler } from '@sveltejs/kit';
import { json } from '@sveltejs/kit';
export const POST = (async ({ cookies }) => {
api.removeAccessToken();
api.removeAccessToken();
cookies.delete('immich_auth_type', { path: '/' });
cookies.delete('immich_access_token', { path: '/' });
cookies.delete('immich_auth_type', { path: '/' });
cookies.delete('immich_access_token', { path: '/' });
return json({ ok: true });
return json({ ok: true });
}) satisfies RequestHandler;

View File

@@ -1,17 +1,17 @@
import { AppRoute } from '$lib/constants';
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
import { AppRoute } from '$lib/constants';
export const load = (async ({ locals: { api } }) => {
const { data } = await api.userApi.getUserCount({ admin: true });
if (data.userCount != 0) {
// Admin has been registered, redirect to login
throw redirect(302, AppRoute.AUTH_LOGIN);
}
const { data } = await api.userApi.getUserCount({ admin: true });
if (data.userCount != 0) {
// Admin has been registered, redirect to login
throw redirect(302, AppRoute.AUTH_LOGIN);
}
return {
meta: {
title: 'Admin Registration'
}
};
return {
meta: {
title: 'Admin Registration',
},
};
}) satisfies PageServerLoad;

View File

@@ -1,16 +1,16 @@
<script lang="ts">
import AdminRegistrationForm from '$lib/components/forms/admin-registration-form.svelte';
import FullscreenContainer from '$lib/components/shared-components/fullscreen-container.svelte';
import type { PageData } from './$types';
import AdminRegistrationForm from '$lib/components/forms/admin-registration-form.svelte';
import FullscreenContainer from '$lib/components/shared-components/fullscreen-container.svelte';
import type { PageData } from './$types';
export let data: PageData;
export let data: PageData;
</script>
<FullscreenContainer title={data.meta.title}>
<p slot="message">
Since you are the first user on the system, you will be assigned as the Admin and are
responsible for administrative tasks, and additional users will be created by you.
</p>
<p slot="message">
Since you are the first user on the system, you will be assigned as the Admin and are responsible for administrative
tasks, and additional users will be created by you.
</p>
<AdminRegistrationForm />
<AdminRegistrationForm />
</FullscreenContainer>