Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8b32f18

Browse files
committed
complete authorization
1 parent9cfa2e7 commit8b32f18

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

‎web-app/src/components/ErrorBoundary/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class ErrorBoundary extends React.Component {
77
// Display fallback UI
88
this.setState({hasError:true})
99
// You can also log the error to an error reporting service
10-
console.error(error)
11-
console.log(info)
10+
console.error(JSON.stringify(error))
11+
console.log(JSON.stringify(info))
1212
}
1313

1414
publicrender(){

‎web-app/src/services/apollo/auth.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ export const setAuthToken = (token: string | null) => {
77
}
88

99
exportconstauthorizeHeaders=(operation:Operation)=>{
10-
operation.setContext({
11-
headers:{
12-
token:authToken
13-
}
14-
})
10+
if(authToken){
11+
operation.setContext({
12+
headers:{
13+
'Authorization':authToken
14+
}
15+
})
16+
}
1517
}

‎web-app/src/services/state/actions/api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import channel from '../../../services/channel'
66

77
exportdefault{
88
authenticate:(async(context:CR.MachineContext):Promise<void>=>{
9+
910
constresult=awaitclient.mutate({
1011
mutation:authenticateMutation,
1112
variables:{
@@ -15,9 +16,10 @@ export default {
1516
}
1617
})
1718

19+
1820
if(!result||!result.data){
1921
// TODO: handle failed authentication
20-
console.log('unauthenticated')
22+
console.error('ERROR: Authentication failed')
2123
}
2224
const{token}=result.data.editorLogin
2325
// add token to headers

‎web-app/src/services/state/actions/context.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import * as selectors from '../../selectors'
66
exportdefault{
77
setEnv:assign({
88
env:(context:CR.MachineContext,event:CR.MachineEvent)=>{
9-
returnevent.payload.env
9+
return{
10+
...context.env,
11+
...event.payload.env
12+
}
1013
}
1114
}),
1215
continueTutorial:assign({

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp