-
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.
feat(update): store, services and .env
- Loading branch information
1 parent
222cec6
commit 8fabdfb
Showing
41 changed files
with
596 additions
and
34 deletions.
There are no files selected for viewing
Empty file.
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 |
---|---|---|
|
@@ -22,3 +22,6 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
|
||
.env.local |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,10 @@ | ||
import { MouseEvent, ReactNode } from 'react'; | ||
|
||
type Props = { | ||
onClick: (event: MouseEvent<HTMLButtonElement>) => void | ||
children: ReactNode | ||
}; | ||
|
||
export type { | ||
Props, | ||
}; |
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 |
---|---|---|
@@ -1,13 +1,12 @@ | ||
import { Error } from './form-error.styled' | ||
|
||
function FormError (props: any) { | ||
const { message, ...restProps } = props | ||
import { Error } from './form-error.styled'; | ||
import { Props } from './form-error.type'; | ||
|
||
function FormError({ message }: Props) { | ||
return ( | ||
<Error {...restProps}> | ||
<Error> | ||
{message} | ||
</Error> | ||
) | ||
); | ||
} | ||
|
||
export default FormError | ||
export default FormError; |
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,7 @@ | ||
type Props = { | ||
message: string | ||
}; | ||
|
||
export type { | ||
Props, | ||
}; |
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,26 @@ | ||
import { useEffect } from 'react'; | ||
import { useSelector } from 'react-redux'; | ||
import { useLocation, useNavigate } from 'react-router'; | ||
|
||
import { Props } from './guard.type'; | ||
import { tokenSelector } from 'store/user/user.selector'; | ||
|
||
function Guard({ children }: Props) { | ||
const token = useSelector(tokenSelector); | ||
const navigate = useNavigate(); | ||
const from = useLocation(); | ||
|
||
useEffect(() => { | ||
if (!token) { | ||
navigate('/login', { | ||
state: { from }, | ||
}); | ||
} | ||
}, []); | ||
|
||
if (!token) return null; | ||
|
||
return children; | ||
} | ||
|
||
export default Guard; |
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,7 @@ | ||
type Props { | ||
|
||
} | ||
|
||
export type { | ||
Props | ||
} |
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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
import { InputStyled } from './input.styled' | ||
import { InputStyled } from './input.styled'; | ||
import { Props } from './input.type'; | ||
|
||
function Input(props: any) { | ||
function Input({ | ||
type, | ||
name, | ||
placeholder, | ||
onChange, | ||
}: Props) { | ||
return ( | ||
<InputStyled {...props}/> | ||
) | ||
<InputStyled type={type} name={name} placeholder={placeholder} onChange={onChange} /> | ||
); | ||
} | ||
|
||
export default Input | ||
export default Input; |
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,12 @@ | ||
import { ChangeEvent } from 'react'; | ||
|
||
type Props = { | ||
type: string; | ||
name: string; | ||
placeholder: string; | ||
onChange: (event: ChangeEvent<HTMLInputElement>) => void | ||
}; | ||
|
||
export type { | ||
Props, | ||
}; |
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,9 @@ | ||
import { Container } from './show-card.styled'; | ||
|
||
function ShowCard() { | ||
return ( | ||
<Container /> | ||
); | ||
} | ||
|
||
export default ShowCard; |
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,10 @@ | ||
import styled from 'styled-components'; | ||
|
||
const Container = styled.div` | ||
`; | ||
|
||
export { | ||
Container, | ||
}; |
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,7 @@ | ||
import axios from 'axios'; | ||
|
||
const axiosInstance = axios.create({ | ||
baseURL: 'http://localhost:3000', | ||
}); | ||
|
||
export default axiosInstance; |
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,9 @@ | ||
import { ShowCard } from '@components'; | ||
|
||
function Home() { | ||
return ( | ||
<ShowCard /> | ||
); | ||
} | ||
|
||
export default Home; |
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,2 @@ | ||
import styled from 'styled-components'; | ||
|
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export { default as Login } from './login/login' | ||
export { default as Login } from './login/login'; | ||
export { default as Home } from './home/home.page'; |
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,11 @@ | ||
|
||
|
||
function MyList() { | ||
return ( | ||
<> | ||
|
||
</> | ||
); | ||
} | ||
|
||
export default MyList; |
Empty file.
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 axiosInstance from '../../modules/axios/axios'; | ||
import { Props } from './shows.type'; | ||
|
||
const showsService = ({ token }: Props) => { | ||
const config = { | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}; | ||
|
||
const getList = () => axiosInstance.get('/shows', config); | ||
|
||
const getMyList = () => axiosInstance.get('/list', config); | ||
|
||
return { | ||
getList, | ||
getMyList, | ||
}; | ||
}; | ||
|
||
export default showsService; |
Oops, something went wrong.