Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 537ce4e

Browse files
authored
Merge pull request #88 from howtocards/feat/59-user-settings-page
2 parents d4df235 + 08850a3 commit 537ce4e

Some content is hidden

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

41 files changed

+480
-431
lines changed

.flowconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ esproposal.decorators=ignore
2626
module.use_strict=true
2727
esproposal.export_star_as=enable
2828

29+
module.name_mapper='^@api/' ->'<PROJECT_ROOT>/src/api/'
2930
module.name_mapper='^@lib/' ->'<PROJECT_ROOT>/src/lib/'
3031
module.name_mapper='^@features/' ->'<PROJECT_ROOT>/src/features/'
3132
module.name_mapper='^@howtocards/ui' ->'<PROJECT_ROOT>/src/ui'

config/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ module.exports = (webpackEnv) => {
276276
? { "react-dom": "@hot-loader/react-dom" }
277277
: undefined),
278278

279+
"@api": path.resolve(paths.appSrc, "api"),
279280
"@features": path.resolve(paths.appSrc, "features"),
280281
"@lib": path.resolve(paths.appSrc, "lib"),
281282
"@howtocards/ui": path.resolve(paths.appSrc, "ui"),

jsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"jsx": "react",
66
"lib": ["es2015", "es2016", "dom"],
77
"paths": {
8+
"@api/*": ["./api/*"],
89
"@features/*": ["./features/*"],
10+
"@howtocards/ui": ["./ui"],
911
"@howtocards/ui/*": ["./ui/*"],
1012
"@lib/*": ["./lib/*"]
1113
}

src/api/account.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// @flow
2+
import { request } from "@features/common"
3+
4+
type RegisterData = {
5+
email: string,
6+
password: string,
7+
}
8+
/**
9+
* https://github.com/howtocards/frontend/tree/master/mock-server/server#post-account-create-user-account
10+
*/
11+
const createAccount = (registerData: RegisterData): Promise<number> =>
12+
request("POST", "/account/", { body: registerData })
13+
14+
export const accountApi = {
15+
createAccount,
16+
}

src/features/cards/api.js renamed to src/api/cards.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
// @flow
22
import { request } from "@features/common"
3-
import type { Card } from "./types"
43

5-
type CreateCard = {
4+
export type Card = {
5+
id: number,
66
title: string,
7+
createdAt: string,
8+
meta: {
9+
canEdit: boolean,
10+
isUseful: boolean,
11+
},
712
content: mixed,
813
}
14+
15+
type CreateCard = {
16+
title: string,
17+
content: {},
18+
}
919
const create = (card: CreateCard): Promise<Card> =>
1020
request("POST", "/cards/", { body: card })
1121

src/api/session.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// @flow
2+
import { request } from "@features/common"
3+
4+
type LoginData = {
5+
email: string,
6+
password: string,
7+
}
8+
/**
9+
* https://github.com/howtocards/frontend/tree/master/mock-server/server#post-accountsession-create-session-token
10+
*/
11+
const createSession = (loginData: LoginData): Promise<{ token: string }> =>
12+
request("POST", "/account/session/", { body: loginData })
13+
14+
/**
15+
* https://github.com/howtocards/frontend/tree/master/mock-server/server#delete-accountsession-drop-session
16+
*/
17+
const dropSession = (token: string): Promise<boolean> =>
18+
request("DELETE", "/account/session/", { body: { token } })
19+
20+
/**
21+
* https://github.com/howtocards/frontend/tree/master/mock-server/server#delete-accountsession-drop-session
22+
*/
23+
const dropAllSessions = (): Promise<boolean> =>
24+
request("DELETE", "/account/session/")
25+
26+
export const sessionApi = {
27+
createSession,
28+
dropSession,
29+
dropAllSessions,
30+
}

src/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React from "react"
1+
// @flow
2+
import * as React from "react"
23
import { hot } from "react-hot-loader"
34

45
import { Normalize } from "styled-normalize"

src/features/cards/index.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import "./model"
1+
// @flow
22

3-
import { type Card } from "./types"
4-
5-
export { $registry as $cardsRegistry } from "./model/registry.store"
6-
export { cardsToObject } from "./model/registry.model"
7-
export { CardItem, CardsList, SkeletonList } from "./organisms"
3+
export {
4+
$registry as $cardsRegistry,
5+
cardsToObject,
6+
} from "./model/registry.store"
7+
export { usefulMarkClicked } from "./model/registry.events"
8+
export { CardItem, CardsList, SkeletonList, CardSkeleton } from "./organisms"
89
export { CardsCommonTemplate } from "./templates/common"
9-
export { cardsRoutes } from "./routes"
10-
11-
export { Card }
10+
export { TitleInput } from "./atoms/title-input"

src/features/cards/model/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/features/cards/model/registry.model.js

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)