Skip to content

Commit

Permalink
Merge pull request #166 from boostcampwm-2024/feature/docker-front
Browse files Browse the repository at this point in the history
back url 못 가져오는 버그 임시 수정
  • Loading branch information
SeoGeonhyuk authored Nov 29, 2024
2 parents 4ad9e55 + af1b823 commit 9109fe1
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion apps/hub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ RUN mkdir -p /app/server
COPY --from=build /build/.next/standalone/ ./standalone/
COPY --from=build /build/.next/static/ ./standalone/.next/static

ENV NEXT_PUBLIC_BACK_URL=http://localhost:3000
ENV BACK_URL=https://api.cloudcanvas.kro.kr
ENTRYPOINT ["sh", "-c", "node standalone/server.js"]
3 changes: 3 additions & 0 deletions apps/hub/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
/* config options here */
output: 'standalone',
env: {
BACK_URL: 'https://api.cloudcanvas.kro.kr',
},
};

export default nextConfig;
6 changes: 3 additions & 3 deletions apps/hub/src/app/architectures/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface PublicArchitecture {
export default function ArchitectureDetailPage() {
const params = useParams<{ id: string }>();
const { data, error, isLoading, mutate } = useSWR<PublicArchitecture>(
`${process.env.NEXT_PUBLIC_BACK_URL}/public-architectures/${params.id}`,
`${process.env.BACK_URL}/public-architectures/${params.id}`,
fetcher,
);

Expand All @@ -48,7 +48,7 @@ export default function ArchitectureDetailPage() {

const toggleStar = async () => {
await fetch(
`${process.env.NEXT_PUBLIC_BACK_URL}/public-architectures/${params.id}/stars`,
`${process.env.BACK_URL}/public-architectures/${params.id}/stars`,
{
method: data!.stars.length > 0 ? 'DELETE' : 'POST',
credentials: 'include',
Expand All @@ -59,7 +59,7 @@ export default function ArchitectureDetailPage() {

const handleImport = async () => {
await fetch(
`${process.env.NEXT_PUBLIC_BACK_URL}/public-architectures/${params.id}/imports`,
`${process.env.BACK_URL}/public-architectures/${params.id}/imports`,
{
method: 'POST',
credentials: 'include',
Expand Down
2 changes: 1 addition & 1 deletion apps/hub/src/app/my/architectures/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function MyArchitecturesPage() {
return (
<Suspense>
<PrivateArchitectureBoard
apiUrl={`${process.env.NEXT_PUBLIC_BACK_URL}/my/private-architectures`}
apiUrl={`${process.env.BACK_URL}/my/private-architectures`}
/>
</Suspense>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/hub/src/app/my/shared/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function MySharedPage() {
return (
<Suspense>
<ArchitectureBoard
apiUrl={`${process.env.NEXT_PUBLIC_BACK_URL}/my/public-architectures`}
apiUrl={`${process.env.BACK_URL}/my/public-architectures`}
/>
</Suspense>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/hub/src/app/my/starred/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function MyStarredPage() {
return (
<Suspense>
<ArchitectureBoard
apiUrl={`${process.env.NEXT_PUBLIC_BACK_URL}/my/public-architectures/stars`}
apiUrl={`${process.env.BACK_URL}/my/public-architectures/stars`}
/>
</Suspense>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/hub/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function Home() {
return (
<Suspense>
<ArchitectureBoard
apiUrl={`${process.env.NEXT_PUBLIC_BACK_URL}/public-architectures`}
apiUrl={`${process.env.BACK_URL}/public-architectures`}
/>
</Suspense>
);
Expand Down
13 changes: 5 additions & 8 deletions apps/hub/src/components/GlobalHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ export const GlobalHeader = () => {
}, []);

const handleLogin = async () => {
const res = await fetch(
`${process.env.NEXT_PUBLIC_BACK_URL}/auth/login`,
{
method: 'POST',
credentials: 'include',
},
);
const res = await fetch(`${process.env.BACK_URL}/auth/login`, {
method: 'POST',
credentials: 'include',
});
if (res.ok) {
setIsLoggedIn(true);
localStorage.setItem('isLoggedIn', 'true');
Expand All @@ -32,7 +29,7 @@ export const GlobalHeader = () => {
};

const handleLogout = () => {
fetch(`${process.env.NEXT_PUBLIC_BACK_URL}/auth/logout`, {
fetch(`${process.env.BACK_URL}/auth/logout`, {
method: 'POST',
credentials: 'include',
});
Expand Down
2 changes: 1 addition & 1 deletion docker-composes/cloud-canvas-front-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
image: cloud-canvas.kr.ncr.ntruss.com/front-hub:dev
container_name: front-hub
environment:
NEXT_PUBLIC_BACK_URL: ${NEXT_PUBLIC_BACK_URL}
BACK_URL: ${BACK_URL}
ports:
- '3000:3000'
networks:
Expand Down

0 comments on commit 9109fe1

Please sign in to comment.