-
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 branch 'dev' into FE-feature/search
- Loading branch information
Showing
12 changed files
with
228 additions
and
13 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,17 @@ | ||
import client from './client'; | ||
|
||
export const getUserInfo = async () => { | ||
const response = await client.get(`user/mypage`); | ||
|
||
return response.data; | ||
}; | ||
|
||
export const changePassword = (data) => { | ||
try { | ||
const response = client.put('user/password', data); | ||
|
||
return response.data; | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
}; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import { header } from '@/components/common'; | ||
import { INPUT } from '@/constants/constant'; | ||
import { navigate } from '@/core/router'; | ||
import { _ } from '@/utils/customFx'; | ||
import { $ } from '@/utils'; | ||
import { getUserInfo, changePassword } from '@/apis/user'; | ||
import { inputForm, notification } from '@/components/common'; | ||
|
||
const MYPAGE_INPUT_TYPE = ['userName', 'tel', 'email', 'password']; | ||
const addInputForm = (fragment) => (input) => inputForm({ ...input, target: fragment })(); | ||
const userPageInputs = ({ type }) => MYPAGE_INPUT_TYPE.includes(type); | ||
|
||
const MyPage = {}; | ||
|
||
MyPage.temp = ` | ||
<article class="auth-article"> | ||
<section class="auth-form-section"> | ||
<form class="input-section"> | ||
<div class="auth-button-container"> | ||
<input type="submit" class="auth-button" name="auth-button" value="완료" /> | ||
</div> | ||
</form> | ||
</section> | ||
</article> | ||
`; | ||
|
||
// prettier-ignore | ||
const setInputValue = async () =>{ | ||
const userData = await getUserInfo(); | ||
console.log(userData); | ||
|
||
const changeColor = (type, target) => { | ||
type === 'input' | ||
? target.style.borderBottom = '1px solid #92b8b1' | ||
: target.style.color = '#92b8b1' | ||
} | ||
|
||
const inputs = $.qsa('.text-input'); | ||
inputs.forEach(element => { | ||
changeColor('input', element); | ||
}); | ||
|
||
const labels = $.qsa('.input-label'); | ||
labels.forEach(element => { | ||
changeColor('label', element); | ||
}) | ||
|
||
const userName = $.qs('#user-name-input'); | ||
userName.value = userData.name; | ||
userName.disabled = true; | ||
|
||
const email = $.qs('#email-input'); | ||
email.value = userData.email; | ||
email.disabled = true; | ||
|
||
const phoneNumber = $.qs('#phone-input'); | ||
phoneNumber.value = userData.phonenumber; | ||
phoneNumber.disabled = true; | ||
|
||
const verifyButton = $.qs('.verify-button'); | ||
verifyButton.remove(); | ||
|
||
|
||
handleSubmitData(); | ||
} | ||
|
||
const submitData = async () => { | ||
const password = $.qs('#password-input'); | ||
|
||
if (password.value === $.qs('#password-check-input').value) { | ||
changePassword({ password: password.value }); | ||
mainpageEvent(); | ||
} | ||
}; | ||
|
||
const mainpageEvent = () => navigate('/card'); | ||
|
||
// prettier-ignore | ||
const handleSubmitData = () => | ||
_.go( | ||
$.qs('.auth-button'), | ||
$.on('click', submitData)); | ||
|
||
// prettier-ignore | ||
const appendInputForm = (fragment) => | ||
_.go( | ||
INPUT, | ||
_.filter(userPageInputs), | ||
([passwordCheck, password, email, tel, userName]) => [passwordCheck, password, email, tel, userName], | ||
_.map(addInputForm(fragment)), | ||
_.flatOne); | ||
|
||
// prettier-ignore | ||
const navigateMyPage = () => { | ||
_.go( | ||
MyPage.temp, | ||
$.el, | ||
$.replace($.qs('#root')), | ||
appendInputForm, | ||
() => setInputValue()); | ||
|
||
header({color: 'white', label:'마이페이지', path:'/card' })(); | ||
} | ||
|
||
export default navigateMyPage; | ||
|
||
// { | ||
// type: 'password', | ||
// name: 'new-password-input', | ||
// label: '비밀번호 변경(영문, 숫자, 특수문자)', | ||
// required: true, | ||
// dataType: 'password', | ||
// }, | ||
// { | ||
// type: 'password', | ||
// name: 'new-password-check-input', | ||
// label: '비밀번호 확인을 위해 한번 더 입력해주세요.', | ||
// required: true, | ||
// dataType: 'passwordCheck', | ||
// }, |
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,52 @@ | ||
import { $ } from '@/utils'; | ||
import { _ } from '@/utils/customFx'; | ||
import { getUsedCard } from '@/apis/card'; | ||
import { header } from '@/components/common'; | ||
import { cardDetail } from '@/components/main'; | ||
|
||
let cardDatas = []; | ||
const setCardDatas = (cardData) => (cardDatas = [...cardData]); | ||
|
||
const detailTemp = (newCardDatas) => { | ||
let idx = 0; | ||
|
||
return ` | ||
${_.go( | ||
newCardDatas, | ||
_.map((card) => cardDetail(card)(idx++)), | ||
_.reduce((a, b) => `${a}${b}`), | ||
)} | ||
`; | ||
}; | ||
|
||
const UsedCardPage = {}; | ||
|
||
UsedCardPage.temp = () => ` | ||
<article class='main-card-article'> | ||
<div class='main-card-container'> | ||
<div class="main-card-box"> | ||
<section class='cards-section list'> | ||
${detailTemp(cardDatas)} | ||
</section> | ||
</div> | ||
</div> | ||
</article> | ||
`; | ||
|
||
// prettier-ignore | ||
UsedCardPage.render = () => | ||
_.go( | ||
UsedCardPage.temp(), | ||
$.el, | ||
$.replace($.qs('#root'))); | ||
|
||
const navigateUsed = async () => { | ||
setCardDatas(await getUsedCard()); | ||
//cardDatas = await getUsedCard(); | ||
|
||
_.go(UsedCardPage.render()); | ||
|
||
header({ color: 'mint' })(); | ||
}; | ||
|
||
export default navigateUsed; |
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,6 +1,8 @@ | ||
export { default as navigateHome } from './HomePage'; | ||
export { default as navigateAuth } from './AuthPage'; | ||
export { default as navigateMain } from './MainPage'; | ||
export { default as navigateUsed } from './UsedCardPage'; | ||
export { default as navigateMyPage } from './MyPage'; | ||
export { default as initiatePostPage } from './PostPage'; | ||
|
||
export { default as NotFound } from './NotFoundPage'; |