Skip to content

Commit

Permalink
fix: guard nullish when parsing env
Browse files Browse the repository at this point in the history
  • Loading branch information
rifandani committed Mar 19, 2024
1 parent 83905dc commit 9cdb057
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"settings": "Settings",
"account": "Account",
"language": "Language",
"english": "English",
"profile": "Profile",
"errorMinLength": "{field} must contain at least {length} characters",
"action": "{module} failed to {action}",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/id-ID.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"settings": "Pengaturan",
"account": "Akun",
"language": "Bahasa",
"english": "Inggris",
"profile": "Profil",
"errorMinLength": "{field} harus memiliki minimal {length} karakter",
"action": "{module} gagal di {action}",
Expand Down
2 changes: 1 addition & 1 deletion src/modules/shared/components/nav-bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function logout() {
<DropdownMenuContent>
<DropdownMenuRadioGroup v-model="locale">
<DropdownMenuRadioItem value="en-US" @select="locale = 'en-US'">
{{ t("common.english") }}
English
</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="id-ID" @select="locale = 'id-ID'">
Indonesia
Expand Down
4 changes: 2 additions & 2 deletions src/modules/shared/configs/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const envSchema = z.object({
})

export const env = (() => {
const appTitle = envSchema.shape.VITE_APP_TITLE.parse(import.meta.env.VITE_APP_TITLE)
const apiBaseUrl = envSchema.shape.VITE_API_BASE_URL.parse(import.meta.env.VITE_API_BASE_URL)
const appTitle = envSchema.shape.VITE_APP_TITLE.parse(import.meta.env.VITE_APP_TITLE ?? 'unknown-VITE_APP_TITLE')
const apiBaseUrl = envSchema.shape.VITE_API_BASE_URL.parse(import.meta.env.VITE_API_BASE_URL ?? 'unknown-VITE_API_BASE_URL')

return {
appTitle,
Expand Down

0 comments on commit 9cdb057

Please sign in to comment.