-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
127 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,6 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
# Sentry Config File | ||
.env.sentry-build-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
FROM oven/bun:1.1.25-alpine AS build-stage | ||
# Build stage | ||
FROM oven/bun:1.1.26-alpine AS build-stage | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json bun.lockb ./ | ||
|
||
RUN bun install | ||
|
||
COPY . . | ||
|
||
ARG BUILD_HASH | ||
ENV VITE_BUILD_HASH=${BUILD_HASH} | ||
|
||
ARG SENTRY_ORG | ||
ENV SENTRY_ORG=${SENTRY_ORG} | ||
|
||
ARG SENTRY_PROJECT | ||
ENV SENTRY_PROJECT=${SENTRY_PROJECT} | ||
|
||
ARG SENTRY_AUTH_TOKEN | ||
ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} | ||
|
||
RUN bun run build-only --mode production | ||
|
||
# Production stage | ||
FROM nginx:stable-alpine-slim AS production-stage | ||
|
||
RUN mkdir /app | ||
|
||
COPY --from=build-stage /app/dist /app | ||
COPY default.conf /etc/nginx/conf.d/default.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
FROM oven/bun:1.1.25-alpine AS build-stage | ||
# Build stage | ||
FROM oven/bun:1.1.26-alpine AS build-stage | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json bun.lockb ./ | ||
|
||
RUN bun install | ||
|
||
COPY . . | ||
|
||
ARG BUILD_HASH | ||
ENV VITE_BUILD_HASH=${BUILD_HASH} | ||
|
||
ARG SENTRY_ORG | ||
ENV SENTRY_ORG=${SENTRY_ORG} | ||
|
||
ARG SENTRY_PROJECT | ||
ENV SENTRY_PROJECT=${SENTRY_PROJECT} | ||
|
||
ARG SENTRY_AUTH_TOKEN | ||
ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} | ||
|
||
RUN bun run build-only --mode staging | ||
|
||
# Staging stage | ||
FROM nginx:stable-alpine-slim AS staging-stage | ||
|
||
RUN mkdir /app | ||
|
||
COPY --from=build-stage /app/dist /app | ||
COPY default.conf /etc/nginx/conf.d/default.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,18 @@ | ||
import { API_BASE_URL } from "@/configs/Constant"; | ||
import { handleResponse } from "@/utils/Response"; | ||
|
||
export const me = async () => { | ||
const response = await fetch(`${API_BASE_URL}/v1/users/me`, { | ||
credentials: "include", | ||
}); | ||
|
||
const result = await response.json(); | ||
|
||
if (!response.ok) { | ||
throw new Error(result.message); | ||
} | ||
|
||
return result.data; | ||
return await handleResponse(response); | ||
}; | ||
|
||
export const getUsers = async () => { | ||
const response = await fetch(`${API_BASE_URL}/v1/users`, { | ||
credentials: "include", | ||
}); | ||
|
||
const result = await response.json(); | ||
|
||
if (!response.ok) { | ||
throw new Error(result.message); | ||
} | ||
|
||
return result.data; | ||
return await handleResponse(response); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export const APP_NAME = import.meta.env.VITE_APP_NAME; | ||
export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || "http://localhost:3000"; | ||
export const MODE = import.meta.env.MODE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as Sentry from "@sentry/react"; | ||
|
||
export const handleResponse = async (response: Response) => { | ||
const result = await response.json(); | ||
|
||
if (!response.ok) { | ||
const status = response.status; | ||
const message = result.message || "An unknown error occurred"; | ||
|
||
if (!(status >= 400 && status < 500)) { | ||
Sentry.captureException(new Error(message), { | ||
extra: { result }, | ||
}); | ||
} | ||
|
||
throw new Error(message); | ||
} | ||
|
||
return result.data; | ||
}; |
Oops, something went wrong.