From dd0f064d8a03c6180f8a4a0d51c082c0b7983349 Mon Sep 17 00:00:00 2001 From: Ethan Wu Date: Wed, 25 Mar 2020 00:21:12 -0400 Subject: [PATCH 1/3] refactor(client): reimplement toasts Reimplement toasts with a more sensible structure, using a provider component for context instead of wrapping a component, and cleaning up implementation. --- client/src/api/profile.js | 3 +- client/src/components/toast.js | 86 +++++++++++++++++++++ client/src/index.js | 14 ++-- client/src/pages/challenges.js | 8 +- client/src/util/index.js | 3 +- client/src/util/toasts/Toast.js | 22 ------ client/src/util/toasts/context.js | 5 -- client/src/util/toasts/index.js | 4 - client/src/util/toasts/useToast.js | 10 --- client/src/util/toasts/withToastProvider.js | 58 -------------- 10 files changed, 100 insertions(+), 113 deletions(-) create mode 100644 client/src/components/toast.js delete mode 100644 client/src/util/toasts/Toast.js delete mode 100644 client/src/util/toasts/context.js delete mode 100644 client/src/util/toasts/index.js delete mode 100644 client/src/util/toasts/useToast.js delete mode 100644 client/src/util/toasts/withToastProvider.js diff --git a/client/src/api/profile.js b/client/src/api/profile.js index e2160e01..45721443 100644 --- a/client/src/api/profile.js +++ b/client/src/api/profile.js @@ -1,5 +1,4 @@ import { request, relog } from './util' -import { toasts } from '../util' export const privateProfile = () => { return request('GET', '/users/me') @@ -31,7 +30,7 @@ export const updateAccount = (name, division) => { case 'goodUserUpdate': return resp.data default: - toasts.useToast().add(resp.message) + // FIXME: implement error handling return null } }) diff --git a/client/src/components/toast.js b/client/src/components/toast.js new file mode 100644 index 00000000..8ff31203 --- /dev/null +++ b/client/src/components/toast.js @@ -0,0 +1,86 @@ +import { createContext } from 'preact' +import { useState, useContext, useCallback, useEffect } from 'preact/hooks' +import withStyles from './jss' + +const ToastCtx = createContext() + +// Use sequential IDs +let toastIdCounter = 0 + +function genToastId () { + return toastIdCounter++ +} + +function Toast ({ children, remove, type, id }) { + const wrappedRemove = useCallback(() => remove(id), [remove, id]) + useEffect(() => { + const duration = 1000 * 5 + const timeout = setTimeout(wrappedRemove, duration) + + return () => clearTimeout(timeout) + }, [wrappedRemove]) + + return ( +
+ {children} +
+ ) +} + +const ToastContainer = withStyles({ + container: { + position: 'fixed', + top: '1em', + right: '1em', + zIndex: 9999, + width: '320px' + } +}, ({ classes, ...props }) =>
) + +export function ToastProvider ({ children }) { + const [toasts, setToasts] = useState([]) + + const remove = useCallback((id) => { + setToasts(toasts => toasts.filter(t => id !== t.id)) + }, []) + const add = useCallback((data) => { + const id = genToastId() + const toast = { + ...data, + id + } + setToasts(toasts => [...toasts, toast]) + return () => remove(id) + }, [remove]) + + return ( + + {children} + { toasts.length > 0 && + + { toasts.map(({ id, type, body }) => + + {body} + + )} + + } + + ) +} + +export function useToast () { + const toast = useContext(ToastCtx) + + return { toast } +} + +export function withToast (Component) { + return function Toasted (props) { + const { toast } = useToast() + return ( + + ) + } +} diff --git a/client/src/index.js b/client/src/index.js index ae4277fb..dfc502cd 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -9,7 +9,7 @@ import Header from './components/header' import { Home, Registration, Login, Profile, Challenges, Scoreboard, Error, Sponsors, Verify, Logout } from './pages' import 'cirrus-ui' -import util from './util' +import { ToastProvider } from './components/toast' class App extends Component { state = { @@ -48,10 +48,12 @@ class App extends Component { return (
-
- - {allPaths} - + +
+ + {allPaths} + +
) } @@ -63,4 +65,4 @@ class App extends Component { } } -export default util.toasts.withToastProvider(App) +export default App diff --git a/client/src/pages/challenges.js b/client/src/pages/challenges.js index 94aa72f6..f4e40e86 100644 --- a/client/src/pages/challenges.js +++ b/client/src/pages/challenges.js @@ -5,7 +5,7 @@ import 'linkstate/polyfill' import withStyles from '../components/jss' import { getChallenges, submitFlag, getPrivateSolves } from '../api/challenges' -import util from '../util' +import { withToast } from '../components/toast' export default withStyles({ frame: { @@ -19,7 +19,7 @@ export default withStyles({ showSolved: { marginBottom: '10px' } -}, class Challenges extends Component { +}, withToast(class Challenges extends Component { state = { problems: [], categories: {}, // Dict with {string name, bool filter} @@ -63,7 +63,7 @@ export default withStyles({ .then(({ error }) => { if (error === undefined) { // Flag was submitted successfully - util.toasts.useToast().add('Flag successfully submitted!') + this.props.toast({ body: 'Flag successfully submitted!', type: 'success' }) this.setState(prevState => ({ solveIDs: [...prevState.solveIDs, id] })) @@ -214,4 +214,4 @@ export default withStyles({
) } -}) +})) diff --git a/client/src/util/index.js b/client/src/util/index.js index 9ae3a172..7ca663f4 100644 --- a/client/src/util/index.js +++ b/client/src/util/index.js @@ -1,4 +1,3 @@ module.exports = { - strings: require('./strings'), - toasts: require('./toasts') + strings: require('./strings') } diff --git a/client/src/util/toasts/Toast.js b/client/src/util/toasts/Toast.js deleted file mode 100644 index 643ae73e..00000000 --- a/client/src/util/toasts/Toast.js +++ /dev/null @@ -1,22 +0,0 @@ -import { useEffect, useRef } from 'preact/compat' - -function Toast ({ children, remove }) { - const removeRef = useRef() - removeRef.current = remove - - useEffect(() => { - const duration = 1000 * 5 - const id = setTimeout(() => removeRef.current(), duration) - - return () => clearTimeout(id) - }, []) - - return ( -
-
- ) -} - -export default Toast diff --git a/client/src/util/toasts/context.js b/client/src/util/toasts/context.js deleted file mode 100644 index 4fb06443..00000000 --- a/client/src/util/toasts/context.js +++ /dev/null @@ -1,5 +0,0 @@ -import React from 'preact/compat' - -const ToastContext = React.createContext(null) - -export default ToastContext diff --git a/client/src/util/toasts/index.js b/client/src/util/toasts/index.js deleted file mode 100644 index 2567b437..00000000 --- a/client/src/util/toasts/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import withToastProvider from './withToastProvider' -import useToast from './useToast' - -export { withToastProvider, useToast } diff --git a/client/src/util/toasts/useToast.js b/client/src/util/toasts/useToast.js deleted file mode 100644 index ec65e062..00000000 --- a/client/src/util/toasts/useToast.js +++ /dev/null @@ -1,10 +0,0 @@ -import { useContext } from 'preact/compat' -import ToastContext from './context' - -function useToast () { - const context = useContext(ToastContext) - - return { add: context.add, remove: context.remove } -} - -export default useToast diff --git a/client/src/util/toasts/withToastProvider.js b/client/src/util/toasts/withToastProvider.js deleted file mode 100644 index b7dc6d77..00000000 --- a/client/src/util/toasts/withToastProvider.js +++ /dev/null @@ -1,58 +0,0 @@ -import { useState, useCallback, createPortal } from 'preact/compat' - -import ToastContext from './context' -import Toast from './Toast' - -// Create a random ID -function generateUEID () { - let first = (Math.random() * 46656) | 0 - let second = (Math.random() * 46656) | 0 - first = (`000${first.toString(36)}`).slice(-3) - second = (`000${second.toString(36)}`).slice(-3) - - return first + second -} - -function withToastProvider (Component) { - function WithToastProvider (props) { - const [toasts, setToasts] = useState([]) - const providerValue = useCallback({ - add: content => { - const id = generateUEID() - - setToasts([...toasts, { id, content }]) - }, - remove: id => setToasts(toasts.filter(t => t.id !== id)) - }, [toasts]) - - const toastWrapperStyle = { - position: 'fixed', - top: '1em', - right: '1em', - zIndex: 9999, - width: '320px' - } - - return ( - - {createPortal( -
- {toasts.map(t => ( - // eslint-disable-next-line react/jsx-no-bind - providerValue.remove(t.id)}> - {t.content} - - ))} -
, - document.body - )} - - -
- ) - } - - return WithToastProvider -} - -export default withToastProvider From ac5a2145a82988b0b96cb38d7fd6f4111fc39b4c Mon Sep 17 00:00:00 2001 From: Robert Chen Date: Wed, 25 Mar 2020 22:00:57 -0700 Subject: [PATCH 2/3] feat(client): add profile error handling --- client/src/api/profile.js | 9 ++- client/src/pages/profile.js | 68 +++++++++-------- yarn.lock | 146 +++--------------------------------- 3 files changed, 53 insertions(+), 170 deletions(-) diff --git a/client/src/api/profile.js b/client/src/api/profile.js index 45721443..b07a0c21 100644 --- a/client/src/api/profile.js +++ b/client/src/api/profile.js @@ -28,10 +28,13 @@ export const updateAccount = (name, division) => { .then(resp => { switch (resp.kind) { case 'goodUserUpdate': - return resp.data + return { + data: resp.data + } default: - // FIXME: implement error handling - return null + return { + error: resp.message + } } }) } diff --git a/client/src/pages/profile.js b/client/src/pages/profile.js index 24b24564..2138139b 100644 --- a/client/src/pages/profile.js +++ b/client/src/pages/profile.js @@ -5,6 +5,7 @@ import 'linkstate/polyfill' import withStyles from '../components/jss' import { privateProfile, publicProfile, deleteAccount, updateAccount } from '../api/profile' +import { withToast } from '../components/toast' import Form from '../components/form' import Modal from '../components/modal' import util from '../util' @@ -75,29 +76,7 @@ const DeleteModal = withStyles({ ) }) -export default withStyles({ - quote: { - fontSize: 'small', - overflowWrap: 'break-word' - }, - icon: { - '& svg': { - verticalAlign: 'middle', - height: '20px', - fill: '#333' - }, - marginRight: '25px' - }, - form: { - '& button': { - margin: 0, - lineHeight: '20px', - padding: '10px', - float: 'right' - }, - padding: '0 !important' - } -}, class Profile extends Component { +class Profile extends Component { state = { loaded: false, name: '', @@ -186,17 +165,22 @@ export default withStyles({ }) updateAccount(this.state.updateName, this.state.updateDivision) - .then(resp => { + .then(({error, data}) => { this.setState({ disabledButton: false }) - if (resp) { - this.setState({ - name: resp.user.name, - division: divisionMap.get(Number.parseInt(resp.user.division)) - }) + if (error !== undefined) { + this.props.toast({ body: error, type: 'error' }) + return } + + this.props.toast({ body: 'Profile updated' }) + + this.setState({ + name: data.user.name, + division: divisionMap.get(Number.parseInt(data.user.division)) + }) }) } @@ -338,4 +322,28 @@ export default withStyles({ ) } -}) +} + +export default withStyles({ + quote: { + fontSize: 'small', + overflowWrap: 'break-word' + }, + icon: { + '& svg': { + verticalAlign: 'middle', + height: '20px', + fill: '#333' + }, + marginRight: '25px' + }, + form: { + '& button': { + margin: 0, + lineHeight: '20px', + padding: '10px', + float: 'right' + }, + padding: '0 !important' + } +}, withToast(Profile)) diff --git a/yarn.lock b/yarn.lock index 77acba62..ae6c377f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -671,7 +671,7 @@ append-transform@^2.0.0: dependencies: default-require-extensions "^3.0.0" -aproba@^1.0.3, aproba@^1.1.1: +aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== @@ -693,14 +693,6 @@ archy@^1.0.0: resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" integrity sha1-+cjBN1fMHde8N5rHeyxipcKGjEA= -are-we-there-yet@~1.1.2: - version "1.1.5" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" - integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -2702,11 +2694,6 @@ console-clear@^1.0.0: resolved "https://registry.yarnpkg.com/console-clear/-/console-clear-1.1.1.tgz#995e20cbfbf14dd792b672cde387bd128d674bf7" integrity sha512-pMD+MVR538ipqkG5JXeOEbKWS5um1H4LUUccUQG68qpeqBYbzYy79Gh55jkd2TtPdRfUaLWdv6LPP//5Zt0aPQ== -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= - console-stream@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/console-stream/-/console-stream-0.1.1.tgz#a095fe07b20465955f2fafd28b5d72bccd949d44" @@ -3406,11 +3393,6 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= - denque@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/denque/-/denque-1.4.1.tgz#6744ff7641c148c3f8a69c307e51235c1f4a37cf" @@ -3451,11 +3433,6 @@ detect-indent@^4.0.0: dependencies: repeating "^2.0.0" -detect-libc@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= - detect-node@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c" @@ -4824,20 +4801,6 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - generic-names@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/generic-names/-/generic-names-1.0.3.tgz#2d786a121aee508876796939e8e3bff836c20917" @@ -5234,11 +5197,6 @@ has-to-string-tag-x@^1.2.0: dependencies: has-symbol-support-x "^1.4.1" -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= - has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" @@ -5509,7 +5467,7 @@ hyphenate-style-name@^1.0.2: resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.3.tgz#097bb7fa0b8f1a9cf0bd5c734cf95899981a9b48" integrity sha512-EcuixamT82oplpoJ2XU4pDtKGWQ7b00CD9f1ug9IaQ3p1bkHMiKCZ9ut9QDI6qsa6cpUuB+A/I+zLtdNK4n2DQ== -iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4: +iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -5550,13 +5508,6 @@ ignore-by-default@^1.0.0, ignore-by-default@^1.0.1: resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" integrity sha1-SMptcvbGo68Aqa1K5odr44ieKwk= -ignore-walk@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" - integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== - dependencies: - minimatch "^3.0.4" - ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" @@ -7183,15 +7134,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -needle@^2.2.1: - version "2.3.3" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.3.3.tgz#a041ad1d04a871b0ebb666f40baaf1fb47867117" - integrity sha512-EkY0GeSq87rWp1hoq/sH/wnTWgFVhYlnIkbJ0YJFfRgEFlz2RraCjBpFQ+vrEgEdp0ThfyHADmkChEhcb7PKyw== - dependencies: - debug "^3.2.6" - iconv-lite "^0.4.4" - sax "^1.2.4" - negotiator@0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" @@ -7274,22 +7216,6 @@ node-pg-migrate@^4.2.2: mkdirp "~1.0.0" yargs "~15.3.0" -node-pre-gyp@*: - version "0.14.0" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.14.0.tgz#9a0596533b877289bcad4e143982ca3d904ddc83" - integrity sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA== - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.1" - needle "^2.2.1" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4.4.2" - node-preload@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/node-preload/-/node-preload-0.2.1.tgz#c03043bb327f417a18fee7ab7ee57b408a144301" @@ -7325,14 +7251,6 @@ nodemon@^2.0.2: undefsafe "^2.0.2" update-notifier "^2.5.0" -nopt@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" - integrity sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg== - dependencies: - abbrev "1" - osenv "^0.1.4" - nopt@~1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" @@ -7391,13 +7309,6 @@ normalize-url@^4.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129" integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ== -npm-bundled@^1.0.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" - integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== - dependencies: - npm-normalize-package-bin "^1.0.1" - npm-conf@^1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/npm-conf/-/npm-conf-1.1.3.tgz#256cc47bd0e218c259c4e9550bf413bc2192aff9" @@ -7406,20 +7317,6 @@ npm-conf@^1.1.0: config-chain "^1.1.11" pify "^3.0.0" -npm-normalize-package-bin@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" - integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== - -npm-packlist@^1.1.6: - version "1.4.8" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.8.tgz#56ee6cc135b9f98ad3d51c1c95da22bbb9b2ef3e" - integrity sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A== - dependencies: - ignore-walk "^3.0.1" - npm-bundled "^1.0.1" - npm-normalize-package-bin "^1.0.1" - npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -7427,16 +7324,6 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -npmlog@^4.0.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - nth-check@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c" @@ -7697,19 +7584,11 @@ os-locale@^2.0.0: lcid "^1.0.0" mem "^1.1.0" -os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.1, os-tmpdir@~1.0.2: +os-tmpdir@^1.0.1, os-tmpdir@~1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" - integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - p-all@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-all/-/p-all-2.1.0.tgz#91419be56b7dee8fe4c5db875d55e0da084244a0" @@ -8990,7 +8869,7 @@ raw-loader@^0.5.1: resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa" integrity sha1-DD0L6u2KAclm2Xh793goElKpeao= -rc@^1.0.1, rc@^1.1.6, rc@^1.2.7, rc@^1.2.8: +rc@^1.0.1, rc@^1.1.6, rc@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== @@ -9075,7 +8954,7 @@ read-pkg@^5.2.0: parse-json "^5.0.0" type-fest "^0.6.0" -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6: +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== @@ -9577,7 +9456,7 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sax@^1.2.4, sax@~1.2.1: +sax@~1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== @@ -9731,7 +9610,7 @@ serviceworker-cache-polyfill@^4.0.0: resolved "https://registry.yarnpkg.com/serviceworker-cache-polyfill/-/serviceworker-cache-polyfill-4.0.0.tgz#de19ee73bef21ab3c0740a37b33db62464babdeb" integrity sha1-3hnuc77yGrPAdAo3sz22JGS6ves= -set-blocking@^2.0.0, set-blocking@~2.0.0: +set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= @@ -10150,7 +10029,7 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: +string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -10461,7 +10340,7 @@ tar-stream@^1.5.2: to-buffer "^1.1.1" xtend "^4.0.0" -tar@^4.4.1, tar@^4.4.2: +tar@^4.4.1: version "4.4.13" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== @@ -11298,13 +11177,6 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -wide-align@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" - integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== - dependencies: - string-width "^1.0.2 || 2" - widest-line@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-2.0.1.tgz#7438764730ec7ef4381ce4df82fb98a53142a3fc" From 197f3d7c1257476136b9c7b3df685bdc72941fe7 Mon Sep 17 00:00:00 2001 From: Robert Chen Date: Wed, 25 Mar 2020 22:01:57 -0700 Subject: [PATCH 3/3] style(client): yarn lint --- client/src/pages/profile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/pages/profile.js b/client/src/pages/profile.js index 2138139b..66d8d6cb 100644 --- a/client/src/pages/profile.js +++ b/client/src/pages/profile.js @@ -165,7 +165,7 @@ class Profile extends Component { }) updateAccount(this.state.updateName, this.state.updateDivision) - .then(({error, data}) => { + .then(({ error, data }) => { this.setState({ disabledButton: false })