-
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.
- Loading branch information
Yuya Otsuka
committed
Nov 21, 2016
1 parent
fb97958
commit 5d61a39
Showing
78 changed files
with
1,284 additions
and
675 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
Binary file not shown.
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,24 @@ | ||
import Authentication from "neeco/views/Authentication" | ||
import EventsView from "neeco/views/pages/EventsView" | ||
import FilesView from "neeco/views/pages/FilesView" | ||
import NewEventView from "neeco/views/pages/NewEventView" | ||
import PasswordSettingsView from "neeco/views/pages/PasswordSettingsView" | ||
import SettingsView from "neeco/views/pages/SettingsView" | ||
import TopView from "neeco/views/pages/TopView" | ||
import React from "react" | ||
import {render} from "react-dom" | ||
import {Router, Route, browserHistory} from "react-router" | ||
|
||
render( | ||
<Router history={browserHistory}> | ||
<Route component={Authentication}> | ||
<Route path="/" component={TopView} /> | ||
<Route path="/events" component={EventsView} /> | ||
<Route path="/files" component={FilesView} /> | ||
<Route path="/new_event" component={NewEventView} /> | ||
<Route path="/settings" component={SettingsView} /> | ||
<Route path="/settings/password" component={PasswordSettingsView} /> | ||
</Route> | ||
</Router>, | ||
document.querySelector(".root") | ||
) |
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,16 @@ | ||
import toFormData from "neeco/core/toFormData" | ||
import environment from "neeco/environment" | ||
import "whatwg-fetch" | ||
|
||
var uri = environment.api.host + "/token" | ||
|
||
export default ({userName, password}) => | ||
fetch(uri, { | ||
method : "POST", | ||
body : toFormData({ | ||
number : userName, | ||
password: password | ||
}) | ||
}) | ||
.then(response => response.json()) | ||
.then(x => Promise.resolve(x.token)) |
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
import environment from "neeco/environment" | ||
import "whatwg-fetch" | ||
|
||
var uri = environment.api.host + "/token/refresh" | ||
|
||
export default ({token}) => | ||
fetch(uri, { | ||
method : "GET", | ||
headers: { | ||
authorization: "Bearer " + token | ||
} | ||
}) | ||
.then(response => response.json()) | ||
.then(x => Promise.resolve(x.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import toURIQuery from "neeco/core/toURIQuery" | ||
import environment from "neeco/environment" | ||
import "whatwg-fetch" | ||
|
||
var uri = environment.api.host + "/events/own" | ||
|
||
export default ({token, offset, limit}) => | ||
fetch(uri + "?" + toURIQuery({ | ||
keyword: "test", | ||
page : "1", | ||
per : limit, | ||
}), { | ||
method : "GET", | ||
headers: { | ||
authorization: "Bearer " + token | ||
} | ||
}) | ||
.then(response => response.json()) | ||
.then(({events}) => Promise.resolve( | ||
events.map((x) => ({ | ||
id : x.id, | ||
title : x.title, | ||
description: x.body | ||
})) | ||
)) |
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,31 @@ | ||
import toFormData from "neeco/core/toFormData" | ||
import environment from "neeco/environment" | ||
import "whatwg-fetch" | ||
|
||
var uri = environment.api.host + "/events" | ||
|
||
export default ({ | ||
token, | ||
title, | ||
start_time, | ||
end_time, | ||
location, | ||
description, | ||
image | ||
}) => | ||
fetch(uri, { | ||
method : "POST", | ||
headers: { | ||
"authorization": "Bearer " + token | ||
}, | ||
body : toFormData({ | ||
title : title, | ||
started_at : start_time, | ||
ended_at : end_time, | ||
venue : location, | ||
body : description, | ||
event_image : image, | ||
entry_upper_limit: 10, | ||
}) | ||
}) | ||
.then(response => response.ok) |
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,21 @@ | ||
import toURIQuery from "neeco/core/toURIQuery" | ||
import environment from "neeco/environment" | ||
import "whatwg-fetch" | ||
|
||
var uri = environment.api.host + "/folders" | ||
|
||
export default ({token}) => | ||
fetch(uri, { | ||
method : "GET", | ||
headers: { | ||
authorization: "Bearer " + token | ||
} | ||
}) | ||
.then(response => response.json()) | ||
.then(({folders}) => Promise.resolve( | ||
folders.map((x) => ({ | ||
id : x.id, | ||
name : x.name, | ||
updatedAt: x.updated_at | ||
})) | ||
)) |
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,20 @@ | ||
import environment from "neeco/environment" | ||
import "whatwg-fetch" | ||
|
||
var uri = environment.api.host + "/users" | ||
|
||
export default ({token, id}) => | ||
fetch(uri + "/" + id, { | ||
method : "GET", | ||
headers: { | ||
authorization: "Bearer " + token | ||
} | ||
}) | ||
.then(response => response.json()) | ||
.then(user => Promise.resolve({ | ||
id : user.id, | ||
number : user.number, | ||
name : user.name, | ||
image : user.image, | ||
college: user.college | ||
})) |
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,24 @@ | ||
import environment from "neeco/environment" | ||
import "whatwg-fetch" | ||
|
||
var uri = environment.api.host + "/users" | ||
|
||
export default ({token}) => | ||
fetch(uri, { | ||
method : "GET", | ||
headers: { | ||
authorization: "Bearer " + token | ||
} | ||
}) | ||
.then(response => response.json()) | ||
.then({users} => Promise.resolve( | ||
users.map( | ||
x => ({ | ||
id : x.id, | ||
number : x.number, | ||
name : x.name, | ||
image : x.image, | ||
college: x.college | ||
}) | ||
) | ||
)) |
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 toFormData from "neeco/core/toFormData" | ||
import environment from "neeco/environment" | ||
import "whatwg-fetch" | ||
|
||
var uri = environment.api.host + "/user/image" | ||
|
||
export default ({token, image}) => | ||
fetch(uri, { | ||
method : "PATCH", | ||
headers: { | ||
"authorization": "Bearer " + token | ||
}, | ||
body : toFormData({ | ||
image: image | ||
}) | ||
}) | ||
.then(response => response.ok) |
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 toFormData from "neeco/core/toFormData" | ||
import environment from "neeco/environment" | ||
import "whatwg-fetch" | ||
|
||
var uri = environment.api.host + "/user/note" | ||
|
||
export default ({token, note}) => | ||
fetch(uri, { | ||
method : "PATCH", | ||
headers: { | ||
"authorization": "Bearer " + token | ||
}, | ||
body : toFormData({ | ||
note: note | ||
}) | ||
}) | ||
.then(response => response.ok) |
10 changes: 5 additions & 5 deletions
10
src/neeco/api/settings/updatePassword.js → src/neeco/api/user/updatePassword.js
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,18 +1,18 @@ | ||
import toFormData from "neeco/core/toFormData" | ||
import environment from "neeco/environment" | ||
import "whatwg-fetch" | ||
|
||
var uri = environment.api.host + "/users/password" | ||
var uri = environment.api.host + "/user/password" | ||
|
||
export default ({token, password, newPassword}) => | ||
fetch(uri, { | ||
method : "PATCH", | ||
headers: { | ||
"Content-Type" : "application/json", | ||
"authorization": "Bearer " + token | ||
}, | ||
body : JSON.stringify({ | ||
"current_password": password, | ||
"new_password" : newPassword | ||
body : toFormData({ | ||
current_password: password, | ||
new_password : newPassword | ||
}) | ||
}) | ||
.then(response => response.ok) |
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,8 @@ | ||
export default (a) => { | ||
var b = new FormData() | ||
|
||
for (var i in a) | ||
b.append(i, a[i]) | ||
|
||
return b | ||
} |
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,8 @@ | ||
export default (a) => { | ||
var b = "" | ||
|
||
for (var i in a) | ||
b += encodeURIComponent(i) + "='" + encodeURIComponent(a[i]) + "'&" | ||
|
||
return b.slice(0, -1) | ||
} |
Oops, something went wrong.