aboutsummaryrefslogtreecommitdiffstats
path: root/apps/Settings
diff options
context:
space:
mode:
authorGravatar piotrruss <mail@pruss.it> 2021-09-06 23:13:22 +0200
committerGravatar piotrruss <mail@pruss.it> 2021-09-06 23:13:22 +0200
commit569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a (patch)
tree8d1cb94a56d60b9d726222277b7516fc59895613 /apps/Settings
parent275bd1d0a9aea90696c145cf992d522a0d6b0aa8 (diff)
downloadmy_apps-569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a.tar.gz
my_apps-569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a.tar.bz2
my_apps-569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a.zip
added stadard linter
Diffstat (limited to 'apps/Settings')
-rw-r--r--apps/Settings/api.js3
-rw-r--r--apps/Settings/components/Settings.js51
2 files changed, 27 insertions, 27 deletions
diff --git a/apps/Settings/api.js b/apps/Settings/api.js
index 559486f..f538368 100644
--- a/apps/Settings/api.js
+++ b/apps/Settings/api.js
@@ -4,7 +4,6 @@ export const saveSettings = async (data) => {
fetchJson('/api/settings', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify(data),
+ body: JSON.stringify(data)
})
}
-
diff --git a/apps/Settings/components/Settings.js b/apps/Settings/components/Settings.js
index c09a1bd..b4a5619 100644
--- a/apps/Settings/components/Settings.js
+++ b/apps/Settings/components/Settings.js
@@ -1,36 +1,36 @@
import styles from '../styles/Settings.module.scss'
import React from 'react'
-import {close} from 'helpers/windowActions'
+import { close } from 'helpers/windowActions'
import useUser from 'hooks/useUser'
import usePopup from 'hooks/usePopup'
import useSettings from 'hooks/useSettings'
import useApps from 'hooks/useApps'
-import {saveSettings} from '../api'
+import { saveSettings } from '../api'
const Settings = () => {
- const {setPopup} = usePopup()
- const {setApps} = useApps()
- const {settings: {theme, language}, setSettings, t} = useSettings()
- const {user} = useUser()
+ const { setPopup } = usePopup()
+ const { setApps } = useApps()
+ const { settings: { theme, language }, setSettings, t } = useSettings()
+ const { user } = useUser()
const handleSave = e => {
- e.preventDefault;
+ e.preventDefault()
- saveSettings({_id: user._id, theme, language})
- .then(() => {
- setPopup({
- content: t('settings_saved'),
- time: 2000,
+ saveSettings({ _id: user._id, theme, language })
+ .then(() => {
+ setPopup({
+ content: t('settings_saved'),
+ time: 2000
+ })
+ close('Settings', setApps)
})
- close('Settings', setApps)
- })
- .catch(() => {
- setpopup({
- content: t('settings_save_error'),
- time: 2000,
- error: true,
+ .catch(() => {
+ setPopup({
+ content: t('settings_save_error'),
+ time: 2000,
+ error: true
+ })
})
- })
}
return (
@@ -41,8 +41,9 @@ const Settings = () => {
<span
key={l}
className={language === l ? styles.settings__langactive : ''}
- onClick={()=>{setSettings(prev => ({...prev, language: l}))}}
- >{l.toUpperCase()}</span>
+ onClick={() => { setSettings(prev => ({ ...prev, language: l })) }}
+ >{l.toUpperCase()}
+ </span>
))}
</div>
<div>{t('color_theme')}</div>
@@ -50,14 +51,14 @@ const Settings = () => {
{['green', 'blue', 'black'].map(c => (
<span
key={c}
- onClick={()=>{setSettings(prev => ({...prev, theme: c}))}}
+ onClick={() => { setSettings(prev => ({ ...prev, theme: c })) }}
className={theme === c ? styles.settings__active : ''}
/>
))}
</div>
<input
- type="button"
- className="window__button"
+ type='button'
+ className='window__button'
value={t('save')}
onClick={handleSave}
/>