Skip to content

Commit

Permalink
vite prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
dlopezalvas committed Apr 25, 2024
1 parent c67ad74 commit b02b93b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 21 deletions.
14 changes: 3 additions & 11 deletions package-lock.json

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

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ShareDialog = ({ open, setDialogOpen }: { open: boolean, setDialogOpen: (o
export const ShareModal = () => {
const { sharedId } = useContext(CreatorContext)

const sharedLink = process.env.PB_APP_URL + `/#/desafio/guardado/${sharedId}`
const sharedLink = process.env.VITE_PB_APP_URL + `/#/desafio/guardado/${sharedId}`

return <Stack>
{sharedId ?
Expand Down
4 changes: 2 additions & 2 deletions src/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export const PBLink = (props: LinkProps & PBLinkProps) => <Link {...props} style


const Version = () => {
if(!process.env.APP_VERSION) throw new Error("Missing Pilas Bloques version. ENV not set")
if(!process.env.VITE_APP_VERSION) throw new Error("Missing Pilas Bloques version. ENV not set")
const {t} = useTranslation("footer")

const appVersion = process.env.APP_VERSION
const appVersion = process.env.VITE_APP_VERSION
const newsUrl = new URL(`/novedades`, siteUrl).toString()
const lastCommitHash = process.env.VITE_GIT_SHORT_COMMIT_HASH
const repoUrl = `https://github.com/Program-AR/pilas-bloques-app/tree/${process.env.VITE_GIT_COMMIT_HASH}`
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { ThemeContextProvider } from './theme/ThemeContext';
import { PBProgress } from "./components/PBProgress";


if (process.env.GOOGLE_ANALYTICS_KEY) {
ReactGA.initialize(process.env.GOOGLE_ANALYTICS_KEY);
if (process.env.VITE_GOOGLE_ANALYTICS_KEY) {
ReactGA.initialize(process.env.VITE_GOOGLE_ANALYTICS_KEY);
}

const root = ReactDOM.createRoot(
Expand Down
3 changes: 1 addition & 2 deletions src/pbApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export namespace PilasBloquesApi{
return isValid
}

export const baseURL = window.PBRuntime?.apiURL || process.env.API_URL
export const baseURL = window.PBRuntime?.apiURL || process.env.VITE_API_URL

async function bodyWithContext<T>(body?: T) {
return body ? {
Expand All @@ -115,7 +115,6 @@ export namespace PilasBloquesApi{
if(user) headers.append('Authorization', `Bearer ${user.token}`)

console.log(url)
console.log(body)

return _doFetch(url, {
method,
Expand Down
2 changes: 1 addition & 1 deletion src/pbSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export namespace PBSession {
online: online(),
browserId: null,
userId: LocalStorage.getUser(),
version: process.env.APP_VERSION,
version: process.env.VITE_APP_VERSION,
experimentGroup: 'off',
url: window.location.href,
ip: await userIp(),
Expand Down
4 changes: 2 additions & 2 deletions src/test/shareByUrl.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe("Share by url", () => {
await shareChallenge()
const urlText = await screen.findByRole('textbox')

expect(urlText.getAttribute('value')).toBe(`${process.env.PB_APP_URL}/#/desafio/guardado/shared`)
expect(urlText.getAttribute('value')).toBe(`${process.env.VITE_PB_APP_URL}/#/desafio/guardado/shared`)
})

test("Should change to save button on challenge share", async () => {
Expand Down Expand Up @@ -130,7 +130,7 @@ describe("Share by url", () => {
const urlText = await screen.findByRole('textbox')

//The url text is not changing in the text
expect(urlText.getAttribute('value')).toBe(`${process.env.PB_APP_URL}/#/desafio/guardado/newShared`)
expect(urlText.getAttribute('value')).toBe(`${process.env.VITE_PB_APP_URL}/#/desafio/guardado/newShared`)
})

})
Expand Down

0 comments on commit b02b93b

Please sign in to comment.