-
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.
Merge pull request #46 from themoment-team/develop
Develop
- Loading branch information
Showing
6 changed files
with
111 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import useSWR from 'swr'; | ||
|
||
import axios from 'axios'; | ||
|
||
type SiteStateToken = 'INSPECTION' | 'NORMAL'; | ||
|
||
interface SiteStateData { | ||
range: string; | ||
majorDimension: string; | ||
values: [[string], [SiteStateToken], [string]]; | ||
} | ||
|
||
interface UseSiteState { | ||
data: SiteStateData; | ||
} | ||
|
||
const useSiteState = () => { | ||
const url = `https://sheets.googleapis.com/v4/spreadsheets/${process.env.gssIdKey}/values/sheet1?key=${process.env.gssApiKey}`; | ||
const { data, error } = useSWR<UseSiteState>(url, axios.get); | ||
|
||
const siteData = data?.data?.values[1][0]; | ||
|
||
return { | ||
data: siteData, | ||
isLoading: !error && !data, | ||
isError: error, | ||
}; | ||
}; | ||
|
||
export default useSiteState; |
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,16 @@ | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
|
||
export async function middleware(req: NextRequest) { | ||
const fetchUrl = `https://sheets.googleapis.com/v4/spreadsheets/${process.env.gssIdKey}/values/sheet1?key=${process.env.gssApiKey}`; | ||
const res = await fetch(fetchUrl); | ||
const data = await res.json(); | ||
const siteState = data?.values[1][0]; | ||
|
||
const { pathname, origin } = req.nextUrl; | ||
|
||
if (siteState === 'INSPECTION' && pathname !== '/site-state/inspection') { | ||
return NextResponse.redirect(`${origin}/site-state/inspection`); | ||
} else { | ||
return NextResponse.next(); | ||
} | ||
} |
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,33 @@ | ||
import styled from '@emotion/styled'; | ||
import { NextPage } from 'next'; | ||
|
||
import { Logo } from 'assets/icons/Logo'; | ||
|
||
const InspectionWrapper = styled.main` | ||
height: 100vh; | ||
display: grid; | ||
place-items: center; | ||
section { | ||
height: fit-content; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
h1 { | ||
font-size: 1rem; | ||
font-weight: 500; | ||
} | ||
`; | ||
|
||
const InspectionPage: NextPage = () => { | ||
return ( | ||
<InspectionWrapper> | ||
<section> | ||
<Logo logoColor="black" /> | ||
<h1> | 서비스가 점검중이에요</h1> | ||
</section> | ||
</InspectionWrapper> | ||
); | ||
}; | ||
|
||
export default InspectionPage; |
4819bd0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
hi-recruit-front – ./
hi-recruit-front-git-master-hi-recruit.vercel.app
hi-recruit-front-hi-recruit.vercel.app
www.hirecruit.site
hirecruit.site