Skip to content

Commit

Permalink
Merge pull request #4 from DevboiDesigns/dev
Browse files Browse the repository at this point in the history
configure env
  • Loading branch information
DevboiDesigns authored Feb 3, 2025
2 parents e01cba4 + 057d1b4 commit 0cf0796
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 16 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.env.*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The `album-viewer` web component fetches and displays albums from a specified [Bandcamp](https://bandcamp.com) artist

![version](https://img.shields.io/badge/v1.0.1-RELEASE-8A2BE2)
![version](https://img.shields.io/badge/v2.0.1-RELEASE-8A2BE2)

---

Expand Down
19 changes: 17 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "album-viewer",
"private": false,
"version": "1.0.1",
"version": "2.0.1",
"type": "module",
"files": [
"dist",
Expand Down Expand Up @@ -59,5 +59,8 @@
"album viewer webcomponent",
"album-viewer-webcomponent",
"album viewer webcomponents"
]
],
"dependencies": {
"dotenv": "^16.4.7"
}
}
4 changes: 2 additions & 2 deletions src/album-viewer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LitElement, css, html } from "lit"
import { customElement, property } from "lit/decorators.js"
import { BASE_URL } from "./utils/base.url"
import { API_URL } from "./utils/base.url"
import { BANDCAMP_URL } from "./utils/bandcamp.url"

@customElement("album-viewer")
Expand All @@ -18,7 +18,7 @@ export class AlbumViewer extends LitElement {
}

async fetchAlbumData() {
const requestUrl = `${BASE_URL()}?name=${this.name}`
const requestUrl = `${API_URL}/album-viewer/?name=${this.name}`
try {
const response = await fetch(requestUrl, {
method: "GET",
Expand Down
8 changes: 2 additions & 6 deletions src/utils/base.url.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
const BASE_URL = (isLocal: boolean = false) => {
return isLocal
? "http://localhost:3000/albums"
: "https://devboi-music-api-3aba476986fd.herokuapp.com/albums"
}
const API_URL = import.meta.env.VITE_API_URL

export { BASE_URL }
export { API_URL }
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es2017",
"module": "es2015",
"module": "es2020",
"moduleResolution": "node",
"lib": ["es2017", "dom"],
"experimentalDecorators": true,
Expand Down
4 changes: 2 additions & 2 deletions types/utils/base.url.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
declare const BASE_URL: (isLocal?: boolean) => "http://localhost:3000/albums" | "https://devboi-music-api-3aba476986fd.herokuapp.com/albums";
export { BASE_URL };
declare const API_URL: any;
export { API_URL };

0 comments on commit 0cf0796

Please sign in to comment.