change setting backend bug fix

This commit is contained in:
Sendou
2019-12-15 19:52:26 +02:00
parent 1035b7a0d0
commit 01f6559e28
3 changed files with 14 additions and 15 deletions

View File

@@ -52,7 +52,7 @@ const Settings = ({ user, closeSettings, handleSuccess, handleError }) => {
],
})
const handleProfileUpdate = async e => {
const handleSubmit = async () => {
const newProfile = { ...forms }
if (newProfile.country === "") newProfile.country = null
if (newProfile.stick_sens === "") newProfile.stick_sens = null
@@ -79,7 +79,7 @@ const Settings = ({ user, closeSettings, handleSuccess, handleError }) => {
<Header size="small">Profile picture</Header>
To add a profile picture you need to verify your Twitter on Discord and
log back in to sendou.ink
<Form style={{ marginTop: "2em" }}>
<Form style={{ marginTop: "2em" }} onSubmit={handleSubmit}>
<Form.Field>
<label>Country</label>
<CountryDropdown
@@ -127,17 +127,17 @@ const Settings = ({ user, closeSettings, handleSuccess, handleError }) => {
multiple
/>
</Form.Field>
</Form>
<div style={{ marginTop: "1.5em" }}>
<Button onClick={() => handleProfileUpdate()} disabled={submitDisabled}>
Save
</Button>
<span style={{ marginLeft: "0.3em" }}>
<Button negative onClick={closeSettings}>
Cancel
<Form.Field>
<Button type="submit" disabled={submitDisabled}>
Save
</Button>
</span>
</div>
<span style={{ marginLeft: "0.3em" }}>
<Button negative onClick={closeSettings}>
Cancel
</Button>
</span>
</Form.Field>
</Form>
</>
)
}

View File

@@ -88,7 +88,6 @@ const UserPage = () => {
setTab(activeIndex)
}
console.log("imageError", imageError)
return (
<>
<>

View File

@@ -110,7 +110,7 @@ const resolvers = {
})
}
if (args.stick_sens) {
if (args.stick_sens !== null) {
const number = Math.floor(args.stick_sens * 10)
if (number < -50 || number > 50 || number % 5 != 0) {
throw new UserInputError("Invalid motion sensitivity", {
@@ -123,7 +123,7 @@ const resolvers = {
delete args.stick_sens
}
if (args.motion_sens) {
if (args.motion_sens !== null) {
const number = Math.floor(args.motion_sens * 10)
if (number < -50 || number > 50 || number % 5 != 0) {
throw new UserInputError("Invalid motion sensitivity", {