-
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 #179 from boostcamp-2020/develop
4주차 배포 수정
- Loading branch information
Showing
56 changed files
with
660 additions
and
130 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,3 @@ | ||
import { INIT_CHANNELS_ASYNC } from '../types/channel-types'; | ||
|
||
export const initChannels = () => ({ type: INIT_CHANNELS_ASYNC }); |
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,6 +1,15 @@ | ||
import { CREATE_MODAL_OPEN, CREATE_MODAL_CLOSE, CHANNEL_MODAL_OPEN, CHANNEL_MODAL_CLOSE } from '@store/types/modal-types'; | ||
import { | ||
CREATE_MODAL_OPEN, | ||
CREATE_MODAL_CLOSE, | ||
CHANNEL_MODAL_OPEN, | ||
CHANNEL_MODAL_CLOSE, | ||
USERBOX_MODAL_OPEN, | ||
USERBOX_MODAL_CLOSE | ||
} from '@store/types/modal-types'; | ||
|
||
export const createModalOpen = () => ({ type: CREATE_MODAL_OPEN }); | ||
export const createModalClose = () => ({ type: CREATE_MODAL_CLOSE }); | ||
export const channelModalOpen = (payload: any) => ({ type: CHANNEL_MODAL_OPEN, payload }); | ||
export const channelModalClose = () => ({ type: CHANNEL_MODAL_CLOSE }); | ||
export const userboxModalOpen = () => ({ type: USERBOX_MODAL_OPEN }); | ||
export const userboxModalClose = () => ({ type: USERBOX_MODAL_CLOSE }); |
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,18 @@ | ||
import { channelsState, ChannelTypes, INIT_CHANNELS } from '../types/channel-types'; | ||
|
||
const initialState: channelsState = { | ||
channelCount: 0, | ||
channels: [] | ||
}; | ||
|
||
export default function channelReducer(state = initialState, action: ChannelTypes) { | ||
switch (action.type) { | ||
case INIT_CHANNELS: | ||
return { | ||
channelCount: action.payload.channelCount, | ||
channels: action.payload.channels | ||
}; | ||
default: | ||
return state; | ||
} | ||
} |
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,17 @@ | ||
import { call, put, takeEvery } from 'redux-saga/effects'; | ||
import API from '@utils/api'; | ||
import { INIT_CHANNELS, INIT_CHANNELS_ASYNC } from '../types/channel-types'; | ||
|
||
function* initChannelsSaga() { | ||
try { | ||
const channelCount = 0; | ||
const channels = yield call(API.getChannels); | ||
yield put({ type: INIT_CHANNELS, payload: { channelCount, channels } }); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
} | ||
|
||
export function* channelSaga() { | ||
yield takeEvery(INIT_CHANNELS_ASYNC, initChannelsSaga); | ||
} |
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,7 +1,8 @@ | ||
import { all } from 'redux-saga/effects'; | ||
import { chatroomSaga } from './chatroom-saga'; | ||
import { userSaga } from './user-saga'; | ||
import { channelSaga } from './channel-saga'; | ||
|
||
export function* rootSaga() { | ||
yield all([chatroomSaga(), userSaga()]); | ||
yield all([chatroomSaga(), userSaga(), channelSaga()]); | ||
} |
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,23 @@ | ||
export const INIT_CHANNELS = 'INIT_CHANNELS'; | ||
export const INIT_CHANNELS_ASYNC = 'INIT_CHANNELS_ASYNC'; | ||
|
||
export interface channelState { | ||
channelId: number; | ||
title: string; | ||
description: string; | ||
isPrivate: boolean; | ||
members: number; | ||
isJoined: boolean; | ||
} | ||
|
||
export interface channelsState { | ||
channelCount: number; | ||
channels: Array<channelState>; | ||
} | ||
|
||
interface InitChannelsAction { | ||
type: typeof INIT_CHANNELS; | ||
payload: channelsState; | ||
} | ||
|
||
export type ChannelTypes = InitChannelsAction; |
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,3 @@ | ||
export const checkAuthToToken = () => { | ||
return !!localStorage.getItem('token'); | ||
}; |
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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import { API, uriParser } from '@utils/index'; | ||
import { API, uriParser, auth } from '@utils/index'; | ||
|
||
const registerToken = async () => { | ||
if (uriParser.isExistParseCode()) { | ||
if (uriParser.isExistParseCodeUrl()) { | ||
const code = uriParser.getCode(); | ||
const token = await API.getToken(code); | ||
if (token) { | ||
localStorage.setItem('token', token); | ||
window.location.href = '/'; | ||
window.location.href = '/client/1'; | ||
} | ||
} | ||
} else if (auth.checkAuthToToken()) window.location.href = '/client/1'; | ||
else window.location.href = '/login'; | ||
}; | ||
|
||
export default registerToken; |
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
Oops, something went wrong.