feat: updated frontend docker containers to allow for runtime environment variable definitions

This commit is contained in:
Andrew Bastin
2023-07-14 16:43:38 +05:30
parent 6454d83486
commit 1b1a09c675
24 changed files with 466 additions and 70 deletions

View File

@@ -17,23 +17,21 @@ const currentUser$ = new BehaviorSubject<HoppUser | null>(null)
export const probableUser$ = new BehaviorSubject<HoppUser | null>(null)
async function logout() {
await axios.get(`${import.meta.env.VITE_BACKEND_API_URL}/auth/logout`, {
await axios.get(`${import.meta.env.APP_BACKEND_API_URL}/auth/logout`, {
withCredentials: true,
})
}
async function signInUserWithGithubFB() {
window.location.href = `${import.meta.env.VITE_BACKEND_API_URL}/auth/github`
window.location.href = `${import.meta.env.APP_BACKEND_API_URL}/auth/github`
}
async function signInUserWithGoogleFB() {
window.location.href = `${import.meta.env.VITE_BACKEND_API_URL}/auth/google`
window.location.href = `${import.meta.env.APP_BACKEND_API_URL}/auth/google`
}
async function signInUserWithMicrosoftFB() {
window.location.href = `${
import.meta.env.VITE_BACKEND_API_URL
}/auth/microsoft`
window.location.href = `${import.meta.env.APP_BACKEND_API_URL}/auth/microsoft`
}
async function getInitialUserDetails() {
@@ -53,7 +51,7 @@ async function getInitialUserDetails() {
message: string
}>
}>(
`${import.meta.env.VITE_BACKEND_GQL_URL}`,
`${import.meta.env.APP_BACKEND_GQL_URL}`,
{
query: `query Me {
me {
@@ -147,7 +145,7 @@ async function setInitialUser() {
async function refreshToken() {
const res = await axios.get(
`${import.meta.env.VITE_BACKEND_API_URL}/auth/refresh`,
`${import.meta.env.APP_BACKEND_API_URL}/auth/refresh`,
{
withCredentials: true,
}
@@ -166,7 +164,7 @@ async function refreshToken() {
async function sendMagicLink(email: string) {
const res = await axios.post(
`${import.meta.env.VITE_BACKEND_API_URL}/auth/signin`,
`${import.meta.env.APP_BACKEND_API_URL}/auth/signin`,
{
email,
},
@@ -284,7 +282,7 @@ export const def: AuthPlatformDef = {
const deviceIdentifier = getLocalConfig("deviceIdentifier")
await axios.post(
`${import.meta.env.VITE_BACKEND_API_URL}/auth/verify`,
`${import.meta.env.APP_BACKEND_API_URL}/auth/verify`,
{
token: token,
deviceIdentifier,