Skip to content

Commit

Permalink
Fix: slash dotenv (#38) (#39)
Browse files Browse the repository at this point in the history
* Update README.md

* Update README.md

* Update README.md

* Bump vite from 4.1.4 to 4.1.5 in /client

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.1.4 to 4.1.5.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.1.5/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.1.5/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...



* Bump @sveltejs/kit from 1.11.0 to 1.15.2 in /client

Bumps [@sveltejs/kit](https://github.com/sveltejs/kit/tree/HEAD/packages/kit) from 1.11.0 to 1.15.2.
- [Release notes](https://github.com/sveltejs/kit/releases)
- [Changelog](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/kit/commits/@sveltejs/kit@1.15.2/packages/kit)

---
updated-dependencies:
- dependency-name: "@sveltejs/kit"
  dependency-type: direct:development
...



* Bump vite from 4.1.5 to 4.5.2 in /client

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.1.5 to 4.5.2.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.5.2/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.2/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...



* Bump mio from 0.8.6 to 0.8.11

Bumps [mio](https://github.com/tokio-rs/mio) from 0.8.6 to 0.8.11.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](tokio-rs/mio@v0.8.6...v0.8.11)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: indirect
...



* Add creating .env step (#36)

* fix: slash in .env causing double slash (#37)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Samuel Durante <44513615+samueldurantes@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 29, 2024
1 parent 89372d7 commit 9483aff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ Navigate into the frontend
cd client
```

Create a .env file containing the following variables

Create a .env file in the `client` folder containing the following variables:
```sh
PUBLIC_API_URL=http://0.0.0.0:3000/
PUBLIC_API_URL=http://0.0.0.0:3000
PUBLIC_WEBSOCKET_URL=ws://localhost:3000
```

Expand Down
6 changes: 5 additions & 1 deletion client/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
const reload = () => {
toast.success("Reloaded rooms")
invalidate(`${env.PUBLIC_API_URL}/rooms`);
let url = `${env.PUBLIC_API_URL}`;
if (url.endsWith("/")) {
url = url.slice(0, -1);
}
invalidate(`${url}/rooms`);
}
</script>

Expand Down
6 changes: 5 additions & 1 deletion client/src/routes/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import {env} from "$env/dynamic/public";

export const load: PageLoad = async ({fetch}) => {
try {
const res = await fetch(`${env.PUBLIC_API_URL}/rooms`);
let url = `${env.PUBLIC_API_URL}`;
if (url.endsWith("/")) {
url = url.slice(0, -1);
}
const res = await fetch(`${url}/rooms`);
return await res.json();
} catch (e) {
return {
Expand Down

0 comments on commit 9483aff

Please sign in to comment.