Skip to content

Commit

Permalink
feat: serverAction allowed origin 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yeolyi committed Apr 7, 2024
1 parent d6d8017 commit 57fa56c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 2 additions & 4 deletions actions/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ export const getMockAuth = async () => {
const cookie = resp.headers.getSetCookie()[0];
const value = cookie.split(/=|;/)[1];

cookies().set(COOKIE_SESSION_ID, value, {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
});
cookies().set(COOKIE_SESSION_ID, value, { httpOnly: true });
};

export const removeAuth = () => {
Expand All @@ -35,6 +32,7 @@ export const getIsStaff = async (): Promise<UserState> => {
cache: 'no-store',
jsessionID: true,
});

return resp.isStaff ? 'staff' : 'non-staff';
} catch {
removeAuth();
Expand Down
4 changes: 2 additions & 2 deletions app/[locale]/about/contact/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import HTMLViewer from '@/components/editor/HTMLViewer';
import PageLayout from '@/components/layout/pageLayout/PageLayout';

export default async function ContactPage() {
const { description } = await getContact();
const { description, imageURL } = await getContact();

return (
<PageLayout titleType="big">
Expand All @@ -15,7 +15,7 @@ export default async function ContactPage() {
widthPX: 240,
heightPX: 360,
marginTopPx: 28,
url: 'https://cse-dev-waffle.bacchus.io/sites/default/files/styles/scale-width-220/public/node--contact/301.jpg?itok=zbUgVCfd',
url: imageURL,
}}
className="mt-[-1.5rem]"
/>
Expand Down
3 changes: 3 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const nextConfig = {
serverActions: {
// 게시물 작성시 첨부파일 지원 목적
bodySizeLimit: '10mb',

// https://github.com/vercel/next.js/issues/58295
allowedOrigins: ['csereal-prod.bacchus.io:443', 'csereal-prod.bacchus.io', 'cse.snu.ac.kr'],
},
},

Expand Down

0 comments on commit 57fa56c

Please sign in to comment.