Add ability to load user votes on frontend
This commit is contained in:
parent
e509c32f79
commit
65f1703089
6
package-lock.json
generated
6
package-lock.json
generated
@ -4457,6 +4457,12 @@
|
|||||||
"whatwg-url": "^7.0.0"
|
"whatwg-url": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"date-fns": {
|
||||||
|
"version": "2.0.0-alpha.27",
|
||||||
|
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.0.0-alpha.27.tgz",
|
||||||
|
"integrity": "sha512-cqfVLS+346P/Mpj2RpDrBv0P4p2zZhWWvfY5fuWrXNR/K38HaAGEkeOwb47hIpQP9Jr/TIxjZ2/sNMQwdXuGMg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"date-now": {
|
"date-now": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
|
||||||
|
|||||||
@ -40,6 +40,7 @@
|
|||||||
"buildfile": "^1.2.22",
|
"buildfile": "^1.2.22",
|
||||||
"bulma": "^0.7.4",
|
"bulma": "^0.7.4",
|
||||||
"cookie-parser": "^1.4.4",
|
"cookie-parser": "^1.4.4",
|
||||||
|
"date-fns": "^2.0.0-alpha.27",
|
||||||
"deep-object-diff": "^1.1.0",
|
"deep-object-diff": "^1.1.0",
|
||||||
"history": "^4.9.0",
|
"history": "^4.9.0",
|
||||||
"jest": "^24.5.0",
|
"jest": "^24.5.0",
|
||||||
|
|||||||
@ -137,6 +137,7 @@ export class CRUDReducer<
|
|||||||
...state,
|
...state,
|
||||||
ids: [...state.ids, payload.id],
|
ids: [...state.ids, payload.id],
|
||||||
byId: {
|
byId: {
|
||||||
|
...state.byId,
|
||||||
[payload.id]: payload,
|
[payload.id]: payload,
|
||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
@ -160,6 +161,7 @@ export class CRUDReducer<
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleRemove = (state: ICRUDState<T>, payload: T): ICRUDState<T> => {
|
handleRemove = (state: ICRUDState<T>, payload: T): ICRUDState<T> => {
|
||||||
|
// FIXME site does not get removed because payload looks different!
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
ids: state.ids.filter(id => id !== payload.id),
|
ids: state.ids.filter(id => id !== payload.id),
|
||||||
|
|||||||
@ -3,7 +3,8 @@ export function without<T, R extends Record<string, T>, K extends keyof R>(
|
|||||||
key: K,
|
key: K,
|
||||||
): Pick<R, Exclude<keyof R, K>> {
|
): Pick<R, Exclude<keyof R, K>> {
|
||||||
return Object.keys(items).reduce((obj, k) => {
|
return Object.keys(items).reduce((obj, k) => {
|
||||||
if (key === k) {
|
/* tslint:disable-next-line */
|
||||||
|
if (key == k) {
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
(obj as any)[k] = items[k]
|
(obj as any)[k] = items[k]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user