Skip to content

Commit

Permalink
client引入prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
HandsomeOne committed Aug 27, 2018
1 parent 1deaa32 commit 7957c96
Show file tree
Hide file tree
Showing 55 changed files with 1,060 additions and 808 deletions.
17 changes: 0 additions & 17 deletions client/.editorconfig

This file was deleted.

5 changes: 5 additions & 0 deletions client/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
20 changes: 11 additions & 9 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
"version": "0.11.2",
"dependencies": {
"@types/classnames": "^2.2.0",
"@types/d3": "^4.10.0",
"@types/d3": "^5.0.0",
"@types/lodash": "^4.14.71",
"@types/react": "^16.0.36",
"@types/react-codemirror": "^1.0.0",
"@types/react-dom": "^16.0.3",
"@types/react-redux": "^5.0.14",
"@types/react-redux": "^6.0.6",
"@types/react-router-dom": "^4.0.7",
"ansi_up": "^2.0.2",
"antd": "^2.12.2",
"ansi_up": "^3.0.0",
"antd": "^3.8.3",
"classnames": "^2.2.5",
"codemirror": "^5.28.0",
"d3": "^4.10.0",
"d3-tip": "^0.7.1",
"d3": "^5.7.0",
"d3-tip": "^0.9.1",
"lodash": "^4.17.4",
"react": "^16.2.0",
"react-codemirror": "^1.0.0",
"react-dom": "^16.2.0",
"react-redux": "^5.0.5",
"react-router-dom": "^4.1.2",
"redux": "^3.7.2",
"redux": "^4.0.0",
"redux-thunk": "^2.2.0",
"typescript": "^2.7.1"
"typescript": "^3.0.1"
},
"devDependencies": {
"react-scripts-ts": "^2.5.0"
"prettier": "^1.14.2",
"react-scripts-ts": "^2.5.0",
"tslint-config-prettier": "^1.15.0"
},
"scripts": {
"start": "react-scripts-ts start",
Expand Down
19 changes: 10 additions & 9 deletions client/src/actions/alertlog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ import { origin } from '../config'
export const RECV_ALERTLOGS = 'RECV_ALERTLOGS'
export const LOADING_ALERTLOGS = 'LOADING_ALERTLOGS'

export const loadAlertLogs = () => (dispatch: any) => (dispatch({
type: LOADING_ALERTLOGS,
payload: {
loading: true,
},
}))
export const loadAlertLogs = () => (dispatch: any) =>
dispatch({
type: LOADING_ALERTLOGS,
payload: {
loading: true,
},
})

export const fetchAlertLogs = (page: any, pageSize: any) => (dispatch: any) =>
fetch(`${origin}/alertlogs?page=${page}&pageSize=${pageSize}`)
.then((res) => {
.then(res => {
if (!res.ok) {
throw new Error(res.statusText)
}
return res.json()
})
.then((json) => {
.then(json => {
dispatch({
type: RECV_ALERTLOGS,
payload: {
Expand All @@ -27,6 +28,6 @@ export const fetchAlertLogs = (page: any, pageSize: any) => (dispatch: any) =>
})
return true
})
.catch((err) => {
.catch(err => {
return false
})
86 changes: 47 additions & 39 deletions client/src/actions/scouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@ export const FATCH_SCOUT = 'FATCH_SCOUT'

export const CLEAN_CHOSEN_SCOUT = 'CLEAN_CHOSEN_SCOUT'

export const loadScouts = () => (dispatch: any) => (dispatch({
type: LOADING_SCOUTS,
payload: {
loading: true,
},
}))
export const loadScouts = () => (dispatch: any) =>
dispatch({
type: LOADING_SCOUTS,
payload: {
loading: true,
},
})

export const fetchScouts = () => (dispatch: any) =>
fetch(`${origin}/scouts`)
.then((res) => {
.then(res => {
if (!res.ok) {
throw new Error(res.statusText)
}
return res.json()
})
.then((json) => {
.then(json => {
dispatch({
type: RECV_SCOUTS,
payload: {
Expand All @@ -37,11 +38,13 @@ export const fetchScouts = () => (dispatch: any) =>
})
return true
})
.catch((err) => {
.catch(err => {
return false
})

export const patchScouts = (selectedScouts: any, patch: any) => (dispatch: any) =>
export const patchScouts = (selectedScouts: any, patch: any) => (
dispatch: any,
) =>
fetch(`${origin}/scouts`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
Expand All @@ -50,13 +53,13 @@ export const patchScouts = (selectedScouts: any, patch: any) => (dispatch: any)
patch,
}),
})
.then((res) => {
.then(res => {
if (!res.ok) {
throw new Error(res.statusText)
}
return res.json()
})
.then((json) => {
.then(json => {
dispatch({
type: PATCH_SCOUTS,
payload: {
Expand All @@ -65,34 +68,37 @@ export const patchScouts = (selectedScouts: any, patch: any) => (dispatch: any)
})
return true
})
.catch((err) => {
.catch(err => {
return false
})

export const cleanSelectedScouts = () => (dispatch: any) => (dispatch({
type: CLEAN_SELECTED_SCOUTS,
payload: {},
}))
export const cleanSelectedScouts = () => (dispatch: any) =>
dispatch({
type: CLEAN_SELECTED_SCOUTS,
payload: {},
})

export const selectScouts = (selectedScouts: any) => (dispatch: any) => (dispatch({
type: SELECTED_SCOUTS,
payload: {
json: selectedScouts,
},
}))
export const selectScouts = (selectedScouts: any) => (dispatch: any) =>
dispatch({
type: SELECTED_SCOUTS,
payload: {
json: selectedScouts,
},
})

export const addScout = (data: any) => (dispatch: any) =>
fetch(`${origin}/scout`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
.then((res) => {
.then(res => {
if (!res.ok) {
throw new Error(res.statusText)
}
return res.json()
}).then((json) => {
})
.then(json => {
dispatch({
type: ADD_SCOUT,
payload: {
Expand All @@ -101,17 +107,18 @@ export const addScout = (data: any) => (dispatch: any) =>
})
return true
})
.catch((err) => {
.catch(err => {
return false
})

export const deleteScout = (id: any) => (dispatch: any) =>
fetch(`${origin}/scout/${id}`, { method: 'DELETE' })
.then((res) => {
.then(res => {
if (!res.ok) {
throw new Error(res.statusText)
}
}).then(() => {
})
.then(() => {
dispatch({
type: DELETE_SCOUT,
payload: {
Expand All @@ -120,7 +127,7 @@ export const deleteScout = (id: any) => (dispatch: any) =>
})
return true
})
.catch((err) => {
.catch(err => {
return false
})

Expand All @@ -130,13 +137,13 @@ export const patchScout = (id: any, data: any) => (dispatch: any) =>
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
.then((res) => {
.then(res => {
if (!res.ok) {
throw new Error(res.statusText)
}
return res.json()
})
.then((json) => {
.then(json => {
dispatch({
type: PATCH_SCOUT,
payload: {
Expand All @@ -146,19 +153,19 @@ export const patchScout = (id: any, data: any) => (dispatch: any) =>
})
return true
})
.catch((err) => {
.catch(err => {
return false
})

export const fetchScout = (id: any) => (dispatch: any) =>
fetch(`${origin}/scout/${id}`)
.then((res) => {
.then(res => {
if (!res.ok) {
throw new Error(res.statusText)
}
return res.json()
})
.then((json) => {
.then(json => {
dispatch({
type: FATCH_SCOUT,
payload: {
Expand All @@ -168,11 +175,12 @@ export const fetchScout = (id: any) => (dispatch: any) =>
})
return true
})
.catch((err) => {
.catch(err => {
return false
})

export const cleanChosenScout = () => (dispatch: any) => (dispatch({
type: CLEAN_CHOSEN_SCOUT,
payload: {},
}))
export const cleanChosenScout = () => (dispatch: any) =>
dispatch({
type: CLEAN_CHOSEN_SCOUT,
payload: {},
})
10 changes: 5 additions & 5 deletions client/src/actions/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ export const RECV_SETTINGS = 'RECEIVE_SETTINGS'

export const fetchSettings = () => (dispatch: any) =>
fetch(`${origin}/settings`)
.then((res) => {
.then(res => {
if (!res.ok) {
throw new Error(res.statusText)
}
return res.json()
})
.then((json) => {
.then(json => {
dispatch({
type: RECV_SETTINGS,
payload: {
Expand All @@ -19,7 +19,7 @@ export const fetchSettings = () => (dispatch: any) =>
})
return true
})
.catch((err) => {
.catch(err => {
return false
})

Expand All @@ -29,13 +29,13 @@ export const patchSettings = (data: any) => (dispatch: any) =>
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
.then((res) => {
.then(res => {
if (!res.ok) {
throw new Error(res.statusText)
}
dispatch(fetchSettings())
return true
})
.catch((err) => {
.catch(err => {
return false
})
Loading

0 comments on commit 7957c96

Please sign in to comment.