diff --git a/src/apis/create-alias.ts b/src/apis/create-alias.ts index 0871aa2..9e5b116 100644 --- a/src/apis/create-alias.ts +++ b/src/apis/create-alias.ts @@ -1,4 +1,4 @@ -import {Alias, AliasType, ImageProxyFormatType, ProxyUserAgentType} from "~/server-types" +import {Alias, AliasType, ImageProxyFormatType, ImageProxyUserAgentType} from "~/server-types" import {client} from "~/constants/axios-client" interface CreateAliasDataOther { @@ -9,7 +9,7 @@ interface CreateAliasDataOther { prefCreateMailReport?: boolean prefProxyImages?: boolean prefImageProxyFormat?: ImageProxyFormatType - prefImageProxyUserAgent?: ProxyUserAgentType + prefImageProxyUserAgent?: ImageProxyUserAgentType } interface CreateAliasDataBase extends CreateAliasDataOther { diff --git a/src/apis/update-alias.ts b/src/apis/update-alias.ts index fc7b026..2937755 100644 --- a/src/apis/update-alias.ts +++ b/src/apis/update-alias.ts @@ -1,4 +1,4 @@ -import {Alias, ImageProxyFormatType, ProxyUserAgentType} from "~/server-types" +import {Alias, ImageProxyFormatType, ImageProxyUserAgentType} from "~/server-types" import {client} from "~/constants/axios-client" export interface UpdateAliasData { @@ -8,13 +8,10 @@ export interface UpdateAliasData { prefCreateMailReport?: boolean | null prefProxyImages?: boolean | null prefImagProxyFormat?: ImageProxyFormatType | null - prefImageProxyUserAgent?: ProxyUserAgentType | null + prefImageProxyUserAgent?: ImageProxyUserAgentType | null } -export default async function updateAlias( - id: string, - updateData: UpdateAliasData, -): Promise { +export default async function updateAlias(id: string, updateData: UpdateAliasData): Promise { const {data} = await client.patch( `${import.meta.env.VITE_SERVER_BASE_URL}/alias/${id}`, updateData, diff --git a/src/apis/update-preferences.ts b/src/apis/update-preferences.ts index a07197f..d552019 100644 --- a/src/apis/update-preferences.ts +++ b/src/apis/update-preferences.ts @@ -1,8 +1,4 @@ -import { - ImageProxyFormatType, - ProxyUserAgentType, - SimpleDetailResponse, -} from "~/server-types" +import {ImageProxyFormatType, ImageProxyUserAgentType, SimpleDetailResponse} from "~/server-types" import {client} from "~/constants/axios-client" export interface UpdatePreferencesData { @@ -10,7 +6,7 @@ export interface UpdatePreferencesData { aliasCreateMailReport?: boolean aliasProxyImages?: boolean aliasImageProxyFormat?: ImageProxyFormatType - aliasImageProxyUserAgent?: ProxyUserAgentType + aliasImageProxyUserAgent?: ImageProxyUserAgentType } export default async function updatePreferences( diff --git a/src/constants/enum-mappings.ts b/src/constants/enum-mappings.ts index e85097b..93abba5 100644 --- a/src/constants/enum-mappings.ts +++ b/src/constants/enum-mappings.ts @@ -1,4 +1,4 @@ -import {ImageProxyFormatType, ProxyUserAgentType} from "~/server-types" +import {ImageProxyFormatType, ImageProxyUserAgentType} from "~/server-types" import {createEnumMapFromTranslation} from "~/utils" export const IMAGE_PROXY_FORMAT_TYPE_NAME_MAP = createEnumMapFromTranslation( @@ -7,5 +7,5 @@ export const IMAGE_PROXY_FORMAT_TYPE_NAME_MAP = createEnumMapFromTranslation( ) export const IMAGE_PROXY_USER_AGENT_TYPE_NAME_MAP = createEnumMapFromTranslation( "relations.alias.settings.imageProxyUserAgent.enumTexts", - ProxyUserAgentType, + ImageProxyUserAgentType, ) diff --git a/src/route-widgets/AliasDetailRoute/AliasPreferencesForm.tsx b/src/route-widgets/AliasDetailRoute/AliasPreferencesForm.tsx index 976e454..698bed3 100644 --- a/src/route-widgets/AliasDetailRoute/AliasPreferencesForm.tsx +++ b/src/route-widgets/AliasDetailRoute/AliasPreferencesForm.tsx @@ -13,7 +13,7 @@ import {mdiTextBoxMultiple} from "@mdi/js/commonjs/mdi" import {useMutation} from "@tanstack/react-query" import Icon from "@mdi/react" -import {Alias, DecryptedAlias, ImageProxyFormatType, ProxyUserAgentType} from "~/server-types" +import {Alias, DecryptedAlias, ImageProxyFormatType, ImageProxyUserAgentType} from "~/server-types" import {UpdateAliasData, updateAlias} from "~/apis" import {parseFastAPIError} from "~/utils" import { @@ -37,7 +37,7 @@ interface Form { createMailReport: boolean | null proxyImages: boolean | null imageProxyFormat: ImageProxyFormatType | null - imageProxyUserAgent: ProxyUserAgentType | null + imageProxyUserAgent: ImageProxyUserAgentType | null detail?: string } @@ -65,8 +65,8 @@ export default function AliasPreferencesForm({ .oneOf([null, ...Object.values(ImageProxyFormatType)]) .label(t("relations.alias.settings.imageProxyFormat.label")), imageProxyUserAgent: yup - .mixed() - .oneOf([null, ...Object.values(ProxyUserAgentType)]) + .mixed() + .oneOf([null, ...Object.values(ImageProxyUserAgentType)]) .label(t("relations.alias.settings.imageProxyUserAgent.label")), }) diff --git a/src/route-widgets/SettingsRoute/AliasesPreferencesForm.tsx b/src/route-widgets/SettingsRoute/AliasesPreferencesForm.tsx index 5230312..a9690b5 100644 --- a/src/route-widgets/SettingsRoute/AliasesPreferencesForm.tsx +++ b/src/route-widgets/SettingsRoute/AliasesPreferencesForm.tsx @@ -22,7 +22,7 @@ import { } from "@mui/material" import {LoadingButton} from "@mui/lab" -import {ImageProxyFormatType, ProxyUserAgentType, SimpleDetailResponse} from "~/server-types" +import {ImageProxyFormatType, ImageProxyUserAgentType, SimpleDetailResponse} from "~/server-types" import {UpdatePreferencesData, updatePreferences} from "~/apis" import {useErrorSuccessSnacks, useUser} from "~/hooks" import {parseFastAPIError} from "~/utils" @@ -37,7 +37,7 @@ interface Form { createMailReport: boolean proxyImages: boolean imageProxyFormat: ImageProxyFormatType - imageProxyUserAgent: ProxyUserAgentType + imageProxyUserAgent: ImageProxyUserAgentType detail?: string } @@ -58,8 +58,8 @@ export default function AliasesPreferencesForm(): ReactElement { .required() .label(t("relations.alias.settings.imageProxyFormat.label")), imageProxyUserAgent: yup - .mixed() - .oneOf(Object.values(ProxyUserAgentType)) + .mixed() + .oneOf(Object.values(ImageProxyUserAgentType)) .required() .label(t("relations.alias.settings.imageProxyUserAgent.label")), }) diff --git a/src/server-types.ts b/src/server-types.ts index 0792148..aa5e515 100644 --- a/src/server-types.ts +++ b/src/server-types.ts @@ -4,7 +4,7 @@ export enum ImageProxyFormatType { JPEG = "jpeg", } -export enum ProxyUserAgentType { +export enum ImageProxyUserAgentType { APPLE_MAIL = "apple-mail", GOOGLE_MAIL = "google-mail", OUTLOOK_WINDOWS = "outlook-windows", @@ -48,7 +48,7 @@ export interface ServerUser { aliasCreateMailReport: boolean aliasProxyImages: boolean aliasImageProxyFormat: ImageProxyFormatType - aliasImageProxyUserAgent: ProxyUserAgentType + aliasImageProxyUserAgent: ImageProxyUserAgentType } } @@ -89,7 +89,7 @@ export interface Alias { prefCreateMailReport: boolean | null prefProxyImages: boolean | null prefImageProxyFormat: ImageProxyFormatType | null - prefImageProxyUserAgent: ProxyUserAgentType | null + prefImageProxyUserAgent: ImageProxyUserAgentType | null } export interface AliasNote {