Skip to content

Commit 3979e40

Browse files
authored
Merge pull request #334 from boostcampwm-2022/dev
Deploy: 6주차 중간 배포
2 parents 5238377 + 34b6f92 commit 3979e40

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+388
-240
lines changed

.github/ISSUE_TEMPLATE/test.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Test
3+
about: 테스팅 관련 이슈
4+
title: "Test"
5+
labels: "🔍 Test"
6+
---
7+
8+
## 🤖 테스트 사항
9+
10+
<!-- 어떤 테스트를 진행하는지 알려주세요. -->
11+
12+
- [ ] test-1
13+
14+
## 📖 참고 사항
15+
16+
<!-- 레퍼런스, 스크린샷 등을 넣어 주세요. -->

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v3
20+
2021
- name: Use node.js ${{ matrix.node-version }}
2122
uses: actions/setup-node@v3
2223
with:
@@ -25,10 +26,10 @@ jobs:
2526
- name: Cache dependencies
2627
id: cache
2728
uses: actions/cache@v3
28-
if: runner.os != 'Windows'
29+
if: runner.os != 'Windows' # 윈도우는 이슈가 있어 캐싱 건너 뜀 (#325 참고)
2930
with:
3031
path: '**/node_modules'
31-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
32+
key: ${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
3233

3334
- name: Install Dependencies
3435
if: steps.cache.outputs.cache-hit != 'true'

@wabinar/api-types/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export interface PostLoginParams {
1+
export interface PostLoginBody {
22
code: string;
33
}

@wabinar/api-types/workspace.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ export interface Workspace {
44
code: string;
55
}
66

7-
export interface PostParams {
7+
export interface PostBody {
88
name: string;
99
}
1010

11-
export interface PostJoinParams {
11+
export interface PostJoinBody {
1212
code: string;
1313
}
1414

File renamed without changes.

@wabinar/constants/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
{
22
"name": "@wabinar/constants",
33
"version": "1.0.0",
4-
"description": "CRDT for wabinar",
5-
"license": "MIT",
6-
"scripts": {
7-
"test": "jest"
8-
},
9-
"devDependencies": {
10-
"jest": "^29.3.1"
11-
}
4+
"description": "Constants for wabinar",
5+
"license": "MIT"
126
}

@wabinar/crdt/linked-list.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,8 @@ export default class LinkedList {
171171

172172
return prevIndex + 1;
173173
} catch (e) {
174-
console.log(`insertById 실패 ^^\n${e}`);
175-
176-
return null;
174+
// console.log(`insertById 실패 ^^\n${e}`);
175+
throw e;
177176
}
178177
}
179178

@@ -197,9 +196,8 @@ export default class LinkedList {
197196

198197
return targetIndex;
199198
} catch (e) {
200-
console.log(`deleteById 실패 ^^\n${e}`);
201-
202-
return null;
199+
// console.log(`deleteById 실패 ^^\n${e}`);
200+
throw e;
203201
}
204202
}
205203

client/index.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
<head>
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6-
<link rel="preconnect" href="https://fonts.googleapis.com" />
7-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
8-
<link
9-
href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap"
10-
rel="stylesheet"
11-
/>
126
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
137
<title>Wabinar</title>
148
</head>

client/src/App.tsx

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { Suspense, useState } from 'react';
2-
import { Route, Routes } from 'react-router-dom';
1+
import { useState, useEffect } from 'react';
2+
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
3+
import { getAuth } from 'src/apis/auth';
34
import UserContext from 'src/contexts/user';
45
import {
56
LoadingPage,
@@ -14,18 +15,38 @@ import 'styles/reset.scss';
1415

1516
function App() {
1617
const [user, setUser] = useState<User | null>(null);
18+
const [isLoaded, setIsLoaded] = useState<boolean>(false);
1719

18-
return (
19-
<Suspense fallback={<LoadingPage />}>
20-
<UserContext.Provider value={{ user, setUser }}>
21-
<Routes>
22-
<Route path="/" element={<LoginPage />} />
23-
<Route path="/oauth" element={<OAuthPage />} />
24-
<Route path="/workspace/*" element={<WorkspacePage />} />
25-
<Route path="/404" element={<NotFoundPage />} />
26-
</Routes>
27-
</UserContext.Provider>
28-
</Suspense>
20+
const location = useLocation();
21+
const navigate = useNavigate();
22+
23+
const autoLogin = async () => {
24+
const { user } = await getAuth();
25+
26+
setIsLoaded(true);
27+
28+
setUser(user);
29+
30+
if (user && !/^\/workspace(\/\d)?$/.test(location.pathname)) {
31+
navigate('/workspace');
32+
}
33+
};
34+
35+
useEffect(() => {
36+
autoLogin();
37+
}, []);
38+
39+
return isLoaded ? (
40+
<UserContext.Provider value={{ user, setUser }}>
41+
<Routes>
42+
<Route path="/" element={<LoginPage />} />
43+
<Route path="/oauth" element={<OAuthPage />} />
44+
<Route path="/workspace/*" element={<WorkspacePage />} />
45+
<Route path="/404" element={<NotFoundPage />} />
46+
</Routes>
47+
</UserContext.Provider>
48+
) : (
49+
<LoadingPage />
2950
);
3051
}
3152

client/src/apis/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PostLoginParams } from '@wabinar/api-types/auth';
1+
import { PostLoginBody } from '@wabinar/api-types/auth';
22
import { User } from 'src/types/user';
33
import { Workspace } from 'src/types/workspace';
44

@@ -21,7 +21,7 @@ export const getAuth = async (): Promise<GetUserInfo> => {
2121

2222
export const postAuthLogin = async ({
2323
code,
24-
}: PostLoginParams): Promise<GetUserInfo> => {
24+
}: PostLoginBody): Promise<GetUserInfo> => {
2525
const res = await http.post(`/auth/login`, { code });
2626

2727
if (res.status !== CREATED) throw new Error();

0 commit comments

Comments
 (0)