-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/side-peek/sidepeek_frontend …
…into refactor/#150/ProjectForm
- Loading branch information
Showing
47 changed files
with
899 additions
and
301 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { getGithubLoginPayload, getGithubLoginResponseType } from "api-models" | ||
|
||
import authToken from "@stores/authToken" | ||
|
||
import { ENDPOINTS } from "@constants/endPoints" | ||
|
||
import { baseInstance } from "../axiosInstance" | ||
|
||
export const getGithubLogin = async ({ | ||
code, | ||
state, | ||
}: getGithubLoginPayload) => { | ||
const { data } = await baseInstance.get<getGithubLoginResponseType>( | ||
`${ENDPOINTS.GITHUB_LOGIN}?code=${code}&state=${state}`, | ||
) | ||
|
||
authToken.setAccessToken(data.accessToken) | ||
authToken.setRefreshToken(data.refreshToken) | ||
|
||
return data | ||
} |
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
49 changes: 49 additions & 0 deletions
49
src/components/ErrorBoundary/UncaughtErrorBoundary/UncaughtErrorBoundary.tsx
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,49 @@ | ||
import { Component, PropsWithChildren } from "react" | ||
|
||
import UncaughtFallback from "./components/UncaughtFallback" | ||
|
||
type State = { | ||
error: Error | null | ||
} | ||
|
||
interface UncaughtErrorBoundaryProps extends PropsWithChildren { | ||
reset: () => void | ||
} | ||
|
||
class UncaughtErrorBoundary extends Component< | ||
UncaughtErrorBoundaryProps, | ||
State | ||
> { | ||
constructor(props: UncaughtErrorBoundaryProps) { | ||
super(props) | ||
this.state = { | ||
error: null, | ||
} | ||
} | ||
|
||
static getDerivedStateFromError(error: Error) { | ||
return { error } | ||
} | ||
|
||
handleReset = () => { | ||
this.props.reset() | ||
this.setState({ error: null }) | ||
} | ||
|
||
render() { | ||
return ( | ||
<> | ||
{this.state.error ? ( | ||
<UncaughtFallback | ||
onReset={this.handleReset} | ||
error={this.state.error} | ||
/> | ||
) : ( | ||
this.props.children | ||
)} | ||
</> | ||
) | ||
} | ||
} | ||
|
||
export default UncaughtErrorBoundary |
42 changes: 42 additions & 0 deletions
42
src/components/ErrorBoundary/UncaughtErrorBoundary/components/UncaughtFallback.tsx
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,42 @@ | ||
import { GrPowerReset } from "react-icons/gr" | ||
import { useNavigate } from "react-router-dom" | ||
|
||
import { Center, Icon, IconButton, Text, VStack } from "@chakra-ui/react" | ||
|
||
interface UncaughtFallbackProps { | ||
error: Error | ||
onReset: () => void | ||
} | ||
|
||
const UncaughtFallback = ({ error, onReset }: UncaughtFallbackProps) => { | ||
const navigate = useNavigate() | ||
return ( | ||
<Center | ||
width="100vw" | ||
height="100vh"> | ||
<VStack gap="5rem"> | ||
<Text | ||
fontFamily="SCDream_Bold" | ||
fontSize="8rem"> | ||
😓 {error.name} | ||
</Text> | ||
<IconButton | ||
aria-label="reset" | ||
icon={ | ||
<Icon | ||
as={GrPowerReset} | ||
w={20} | ||
h={20} | ||
/> | ||
} | ||
onClick={() => { | ||
onReset() | ||
navigate("/") | ||
}} | ||
/> | ||
</VStack> | ||
</Center> | ||
) | ||
} | ||
|
||
export default UncaughtFallback |
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,40 @@ | ||
import { ChangeEvent } from "react" | ||
|
||
import { Checkbox, HStack, Select, Spacer } from "@chakra-ui/react" | ||
|
||
import { SortSelectType } from "@pages/HomePage/types/type" | ||
|
||
interface ProjectFilterProps { | ||
handleChange: () => void | ||
sortOption: SortSelectType | ||
handleSelect: (e: ChangeEvent<HTMLSelectElement>) => void | ||
} | ||
|
||
const ProjectFilter = ({ | ||
handleChange, | ||
sortOption, | ||
handleSelect, | ||
}: ProjectFilterProps) => { | ||
return ( | ||
<HStack spacing={5}> | ||
<Spacer /> | ||
<Checkbox | ||
paddingRight="0.3rem" | ||
onChange={handleChange}> | ||
출시 서비스만 보기 | ||
</Checkbox> | ||
<Select | ||
width="10rem" | ||
variant="outline" | ||
marginRight="1rem" | ||
onChange={handleSelect} | ||
value={sortOption}> | ||
<option value="createdAt">최신순</option> | ||
<option value="like">인기순</option> | ||
<option value="view">조회순</option> | ||
</Select> | ||
</HStack> | ||
) | ||
} | ||
|
||
export default ProjectFilter |
Oops, something went wrong.