refactor(client): tighten env type
Signed-off-by: Noa Virellia <noa@requiem.garden>
This commit is contained in:
@@ -8,10 +8,13 @@ import { getToken } from '@/lib/token';
|
|||||||
import { useExchangeToken } from '@/hooks/data/useExchangeToken';
|
import { useExchangeToken } from '@/hooks/data/useExchangeToken';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
|
|
||||||
|
const baseUrl = import.meta.env.VITE_APP_BASE_URL;
|
||||||
|
|
||||||
const authorizeSchema = z.object({
|
const authorizeSchema = z.object({
|
||||||
response_type: z.literal('code').default('code'),
|
response_type: z.literal('code').default('code'),
|
||||||
client_id: z.literal('org_client').default('org_client'),
|
client_id: z.literal('org_client').default('org_client'),
|
||||||
redirect_uri: z.string().default(`${new URL(import.meta.env.VITE_APP_BASE_URL as string).toString()}token`),
|
redirect_uri: z.string().default(`${new URL(baseUrl).toString()}token`),
|
||||||
state: z.string().default(generateOAuthState()),
|
state: z.string().default(generateOAuthState()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
11
client/cms/src/vite.env.d.ts
vendored
Normal file
11
client/cms/src/vite.env.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
interface ViteTypeOptions {
|
||||||
|
strictImportMetaEnv: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ImportMetaEnv {
|
||||||
|
readonly VITE_APP_BASE_URL: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ImportMeta {
|
||||||
|
readonly env: ImportMetaEnv
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user