-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #213 from naya-h2/feat/admin
✨ feat: 아티스트 페이지 메타태그 SSR로 변경
- Loading branch information
Showing
5 changed files
with
55 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ReactNode } from "react"; | ||
import { getArtist, getGroup } from "@/utils/getArtist"; | ||
import MetaTag from "@/components/MetaTag"; | ||
|
||
interface Props { | ||
children: ReactNode; | ||
params: { artistId: string }; | ||
} | ||
|
||
const getArtistName = async (artistId: string) => { | ||
let res; | ||
try { | ||
const groupData = await fetch(`https://${process.env.NEXT_PUBLIC_BASE_URL}/group?groupId=${artistId}`); | ||
res = await groupData.json(); | ||
if(res.message) throw Error(); | ||
return res; | ||
} catch(err){ | ||
const artistData = await fetch(`https://${process.env.NEXT_PUBLIC_BASE_URL}/artist?artists=${artistId}`); | ||
res = await artistData.json(); | ||
return res[0]; | ||
} | ||
}; | ||
|
||
const layout = async ({ children, params }: Props) => { | ||
const res = await getArtistName(params.artistId); | ||
|
||
return ( | ||
<> | ||
<MetaTag title={`${res?.groupName || res?.artistName} - 행사 지도`} imgUrl={res?.groupImage || res?.artistImage} description={`${res?.groupName || res?.artistName}의 행사 정보들을 지도를 통해 쉽게 확인해 보세요.`} /> | ||
{children} | ||
</> | ||
); | ||
}; | ||
|
||
export default layout; |
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