mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-12 16:45:14 +00:00
refactor: run formatter
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import * as Command from '$lib/components/ui/command';
|
||||
import * as Popover from '$lib/components/ui/popover';
|
||||
import { cn } from '$lib/utils/style';
|
||||
import { m } from '$lib/paraglide/messages';
|
||||
import { m } from '$lib/paraglide/messages';
|
||||
import { LoaderCircle, LucideCheck, LucideChevronDown } from '@lucide/svelte';
|
||||
import type { FormEventHandler } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import SunIcon from '@lucide/svelte/icons/sun';
|
||||
import MoonIcon from '@lucide/svelte/icons/moon';
|
||||
import SunIcon from '@lucide/svelte/icons/sun';
|
||||
|
||||
import { mode, resetMode, setMode } from 'mode-watcher';
|
||||
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
||||
import { buttonVariants } from '$lib/components/ui/button/index.js';
|
||||
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
||||
import { m } from '$lib/paraglide/messages';
|
||||
import { mode, resetMode, setMode } from 'mode-watcher';
|
||||
|
||||
const isDark = $derived(mode.current === 'dark');
|
||||
</script>
|
||||
|
||||
@@ -36,7 +36,10 @@
|
||||
|
||||
async function createLoginCode() {
|
||||
try {
|
||||
code = await userService.createOneTimeAccessToken(userId!, availableExpirations[selectedExpiration]);
|
||||
code = await userService.createOneTimeAccessToken(
|
||||
userId!,
|
||||
availableExpirations[selectedExpiration]
|
||||
);
|
||||
oneTimeLink = `${page.url.origin}/lc/${code}`;
|
||||
} catch (e) {
|
||||
axiosErrorToast(e);
|
||||
@@ -45,7 +48,10 @@
|
||||
|
||||
async function sendLoginCodeEmail() {
|
||||
try {
|
||||
await userService.requestOneTimeAccessEmailAsAdmin(userId!, availableExpirations[selectedExpiration]);
|
||||
await userService.requestOneTimeAccessEmailAsAdmin(
|
||||
userId!,
|
||||
availableExpirations[selectedExpiration]
|
||||
);
|
||||
toast.success(m.login_code_email_success());
|
||||
onOpenChange(false);
|
||||
} catch (e) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Root from "./skeleton.svelte";
|
||||
import Root from './skeleton.svelte';
|
||||
|
||||
export {
|
||||
Root,
|
||||
//
|
||||
Root as Skeleton,
|
||||
Root as Skeleton
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { cn, type WithElementRef, type WithoutChildren } from "$lib/utils/style.js";
|
||||
import type { HTMLAttributes } from "svelte/elements";
|
||||
import { cn, type WithElementRef, type WithoutChildren } from '$lib/utils/style.js';
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
@@ -12,6 +12,6 @@
|
||||
<div
|
||||
bind:this={ref}
|
||||
data-slot="skeleton"
|
||||
class={cn("bg-accent animate-pulse rounded-md", className)}
|
||||
class={cn('bg-accent animate-pulse rounded-md', className)}
|
||||
{...restProps}
|
||||
></div>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import axios from 'axios';
|
||||
|
||||
abstract class APIService {
|
||||
protected api = axios.create({ baseURL: '/api' });
|
||||
protected api = axios.create({ baseURL: '/api' });
|
||||
|
||||
constructor() {
|
||||
if (typeof process !== 'undefined' && process?.env?.DEVELOPMENT_BACKEND_URL) {
|
||||
this.api.defaults.baseURL = process.env.DEVELOPMENT_BACKEND_URL;
|
||||
}
|
||||
}
|
||||
constructor() {
|
||||
if (typeof process !== 'undefined' && process?.env?.DEVELOPMENT_BACKEND_URL) {
|
||||
this.api.defaults.baseURL = process.env.DEVELOPMENT_BACKEND_URL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default APIService;
|
||||
|
||||
@@ -4,35 +4,35 @@ import APIService from './api-service';
|
||||
import userStore from '$lib/stores/user-store';
|
||||
import type { AuthenticationResponseJSON, RegistrationResponseJSON } from '@simplewebauthn/browser';
|
||||
class WebAuthnService extends APIService {
|
||||
getRegistrationOptions = async () => (await this.api.get(`/webauthn/register/start`)).data;
|
||||
getRegistrationOptions = async () => (await this.api.get(`/webauthn/register/start`)).data;
|
||||
|
||||
finishRegistration = async (body: RegistrationResponseJSON) =>
|
||||
(await this.api.post(`/webauthn/register/finish`, body)).data as Passkey;
|
||||
finishRegistration = async (body: RegistrationResponseJSON) =>
|
||||
(await this.api.post(`/webauthn/register/finish`, body)).data as Passkey;
|
||||
|
||||
getLoginOptions = async () => (await this.api.get(`/webauthn/login/start`)).data;
|
||||
getLoginOptions = async () => (await this.api.get(`/webauthn/login/start`)).data;
|
||||
|
||||
finishLogin = async (body: AuthenticationResponseJSON) =>
|
||||
(await this.api.post(`/webauthn/login/finish`, body)).data as User;
|
||||
finishLogin = async (body: AuthenticationResponseJSON) =>
|
||||
(await this.api.post(`/webauthn/login/finish`, body)).data as User;
|
||||
|
||||
logout = async () => {
|
||||
await this.api.post(`/webauthn/logout`);
|
||||
userStore.clearUser();
|
||||
};
|
||||
logout = async () => {
|
||||
await this.api.post(`/webauthn/logout`);
|
||||
userStore.clearUser();
|
||||
};
|
||||
|
||||
listCredentials = async () => (await this.api.get(`/webauthn/credentials`)).data as Passkey[];
|
||||
listCredentials = async () => (await this.api.get(`/webauthn/credentials`)).data as Passkey[];
|
||||
|
||||
removeCredential = async (id: string) => {
|
||||
await this.api.delete(`/webauthn/credentials/${id}`);
|
||||
};
|
||||
removeCredential = async (id: string) => {
|
||||
await this.api.delete(`/webauthn/credentials/${id}`);
|
||||
};
|
||||
|
||||
updateCredentialName = async (id: string, name: string) => {
|
||||
await this.api.patch(`/webauthn/credentials/${id}`, { name });
|
||||
};
|
||||
updateCredentialName = async (id: string, name: string) => {
|
||||
await this.api.patch(`/webauthn/credentials/${id}`, { name });
|
||||
};
|
||||
|
||||
reauthenticate = async (body?: AuthenticationResponseJSON) => {
|
||||
const res = await this.api.post('/webauthn/reauthenticate', body);
|
||||
return res.data.reauthenticationToken as string;
|
||||
};
|
||||
reauthenticate = async (body?: AuthenticationResponseJSON) => {
|
||||
const res = await this.api.post('/webauthn/reauthenticate', body);
|
||||
return res.data.reauthenticationToken as string;
|
||||
};
|
||||
}
|
||||
|
||||
export default WebAuthnService;
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { Component, Snippet } from 'svelte';
|
||||
export type AdvancedTableColumn<T extends Record<string, any>> = {
|
||||
label: string;
|
||||
column?: keyof T & string;
|
||||
key?: string;
|
||||
key?: string;
|
||||
value?: (item: T) => string | number | boolean | undefined;
|
||||
cell?: Snippet<[{ item: T }]>;
|
||||
sortable?: boolean;
|
||||
@@ -12,9 +12,11 @@ export type AdvancedTableColumn<T extends Record<string, any>> = {
|
||||
value: string | boolean;
|
||||
icon?: Component;
|
||||
}[];
|
||||
hidden?: boolean;
|
||||
hidden?: boolean;
|
||||
};
|
||||
export type CreateAdvancedTableActions<T extends Record<string, any>> = (item: T) => AdvancedTableAction<T>[];
|
||||
export type CreateAdvancedTableActions<T extends Record<string, any>> = (
|
||||
item: T
|
||||
) => AdvancedTableAction<T>[];
|
||||
|
||||
export type AdvancedTableAction<T> = {
|
||||
label: string;
|
||||
|
||||
@@ -9,8 +9,8 @@ export const eventTypes: Record<string, string> = {
|
||||
DEVICE_CODE_AUTHORIZATION: m.device_code_authorization(),
|
||||
NEW_DEVICE_CODE_AUTHORIZATION: m.new_device_code_authorization(),
|
||||
PASSKEY_ADDED: m.passkey_added(),
|
||||
PASSKEY_REMOVED: m.passkey_removed(),
|
||||
}
|
||||
PASSKEY_REMOVED: m.passkey_removed()
|
||||
};
|
||||
|
||||
/**
|
||||
* Translates an audit log event type using paraglide messages.
|
||||
|
||||
@@ -22,9 +22,13 @@ export const cachedApplicationLogo: CachableImage = {
|
||||
|
||||
export const cachedDefaultProfilePicture: CachableImage = {
|
||||
getUrl: () =>
|
||||
getCachedImageUrl(new URL('/api/application-images/default-profile-picture', window.location.origin)),
|
||||
getCachedImageUrl(
|
||||
new URL('/api/application-images/default-profile-picture', window.location.origin)
|
||||
),
|
||||
bustCache: () =>
|
||||
bustImageCache(new URL('/api/application-images/default-profile-picture', window.location.origin))
|
||||
bustImageCache(
|
||||
new URL('/api/application-images/default-profile-picture', window.location.origin)
|
||||
)
|
||||
};
|
||||
|
||||
export const cachedBackgroundImage: CachableImage = {
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
value,
|
||||
label
|
||||
}))
|
||||
]}
|
||||
]}
|
||||
bind:value={filters.event}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user