mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-09-30 20:46:57 -05:00
feat: add parsable error handling to api methods
This commit is contained in:
10
src/composables/errors.ts
Normal file
10
src/composables/errors.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { FetchError } from 'ofetch';
|
||||
import { getApiError as baseGetApiError } from '~~/shared/errors';
|
||||
import type { ApiError } from '~~/shared/errors';
|
||||
|
||||
export function getApiError(error: any): ApiError {
|
||||
if (error instanceof FetchError) {
|
||||
return baseGetApiError(error.data);
|
||||
}
|
||||
return baseGetApiError(error);
|
||||
}
|
||||
41
src/plugins/types.d.ts
vendored
41
src/plugins/types.d.ts
vendored
@@ -4,4 +4,45 @@ declare module '#app' {
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'nuxt/schema' {
|
||||
interface RuntimeConfig {
|
||||
githubApiToken: string;
|
||||
|
||||
stripeSecretKey: string;
|
||||
stripeNotificationEmail: string;
|
||||
|
||||
hcaptchaSecretKey: string;
|
||||
|
||||
grpcHost: string;
|
||||
grpcApiKey: string;
|
||||
|
||||
mongoConnectionString: string;
|
||||
|
||||
smtpHost: string;
|
||||
smtpPort: number;
|
||||
smtpUser: string;
|
||||
smtpPassword: string;
|
||||
smtpSecure: true;
|
||||
smtpFromEmail: string;
|
||||
smtpFromName: string;
|
||||
|
||||
discordBotToken: string;
|
||||
discordClientId: string;
|
||||
discordClientSecret: string;
|
||||
discordGuildId: string;
|
||||
discordTesterRoleId: string;
|
||||
discordSupporterRoleId: string;
|
||||
|
||||
discourseSsoSecret: string;
|
||||
}
|
||||
|
||||
interface PublicRuntimeConfig {
|
||||
baseUrl: string;
|
||||
apiBase: string;
|
||||
cookieSecure: boolean;
|
||||
|
||||
hcaptchaSiteKey: string;
|
||||
}
|
||||
}
|
||||
|
||||
export { };
|
||||
|
||||
Reference in New Issue
Block a user