mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
Merge branch 'main' into lint-security
This commit is contained in:
commit
f4e71050a5
38
.eslintrc.js
38
.eslintrc.js
@ -23,9 +23,9 @@ module.exports = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
'@typescript-eslint',
|
'@typescript-eslint',
|
||||||
'import',
|
'import',
|
||||||
// 'promise',
|
'promise',
|
||||||
'security',
|
'security',
|
||||||
// 'no-catch-all',
|
'no-catch-all',
|
||||||
'react',
|
'react',
|
||||||
'react-hooks',
|
'react-hooks',
|
||||||
],
|
],
|
||||||
@ -44,8 +44,8 @@ module.exports = {
|
|||||||
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
|
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
|
||||||
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
|
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
|
||||||
'react/react-in-jsx-scope': 'off', // Disable requirement for React import
|
'react/react-in-jsx-scope': 'off', // Disable requirement for React import
|
||||||
// 'no-catch-all/no-catch-all': 'error',
|
'no-catch-all/no-catch-all': 'error',
|
||||||
// 'no-console': 'error',
|
'no-console': 'error',
|
||||||
'no-debugger': 'error',
|
'no-debugger': 'error',
|
||||||
camelcase: 'error',
|
camelcase: 'error',
|
||||||
indent: ['error', 2],
|
indent: ['error', 2],
|
||||||
@ -122,21 +122,21 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
'import/prefer-default-export': 'off',
|
'import/prefer-default-export': 'off',
|
||||||
// // promise
|
// promise
|
||||||
// 'promise/catch-or-return': 'error',
|
'promise/catch-or-return': 'error',
|
||||||
// 'promise/no-return-wrap': 'error',
|
'promise/no-return-wrap': 'error',
|
||||||
// 'promise/param-names': 'error',
|
'promise/param-names': 'error',
|
||||||
// 'promise/always-return': 'error',
|
'promise/always-return': 'error',
|
||||||
// 'promise/no-native': 'off',
|
'promise/no-native': 'off',
|
||||||
// 'promise/no-nesting': 'warn',
|
'promise/no-nesting': 'warn',
|
||||||
// 'promise/no-promise-in-callback': 'warn',
|
'promise/no-promise-in-callback': 'warn',
|
||||||
// 'promise/no-callback-in-promise': 'warn',
|
'promise/no-callback-in-promise': 'warn',
|
||||||
// 'promise/avoid-new': 'warn',
|
'promise/avoid-new': 'warn',
|
||||||
// 'promise/no-new-statics': 'error',
|
'promise/no-new-statics': 'error',
|
||||||
// 'promise/no-return-in-finally': 'warn',
|
'promise/no-return-in-finally': 'warn',
|
||||||
// 'promise/valid-params': 'warn',
|
'promise/valid-params': 'warn',
|
||||||
// 'promise/prefer-await-to-callbacks': 'error',
|
'promise/prefer-await-to-callbacks': 'error',
|
||||||
// 'promise/no-multiple-resolved': 'error',
|
'promise/no-multiple-resolved': 'error',
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
|
|||||||
16
README.md
16
README.md
@ -1,25 +1,27 @@
|
|||||||
# Utopia UI [](https://www.npmjs.com/package/utopia-ui)
|
# Utopia UI [](https://www.npmjs.com/package/utopia-ui)
|
||||||
**UI Framework for Real-Life-Networking-Apps**
|
**UI Framework for Real-Life-Networking-Apps**
|
||||||
|
|
||||||
*Real change happens in real life when we meet in person and connect as local communities manifesting their ideas with the earth. When we help each other to step out of capitalism and individualism and start building common infrastructure to meet human needs in harmony with Mother Earth.*
|
*Real change happens in real life when we meet in person and connect as local communities manifesting their ideas with the earth. When we help each other to step out of our bubbles at home and start building common infrastructure to meet human needs in harmony with Mother Earth.*
|
||||||
|
|
||||||
*That is why Utopia UI exists. It is a UI kit for minimalist, fast, intuitive and mobile-first map apps, as a tool for local connection and decentralised networking. It can work with any backend or p2p database and any kind of data structure.*
|
*That is why Utopia UI exists. It is a UI kit for minimalist, fast, intuitive and mobile-first map apps, as a tool for local connection and decentralised networking. We believe in maps as the perfect link between digital tools and real life action*
|
||||||
|
|
||||||
|
*It can work with any backend or p2p database and any kind of data structure.*
|
||||||
|
|
||||||
## Mission
|
## Mission
|
||||||
Utopia UIs mission is to provide open source building blocks to create beautiful applications with a focus on real life impact, local communities and gamification.
|
Utopia UIs mission is to provide open source building blocks to create beautiful applications with a focus on real life impact, local communities and gamification.
|
||||||
|
|
||||||
The building blocks are designed to allow different networks and communities to assemble their map and app for their specific needs and purpose.
|
The building blocks are designed to allow different networks and communities to assemble their map and app for their specific needs and purpose.
|
||||||
|
|
||||||
Utopia Game is one of the apps made with Utopia UI. It is an attempt to use gamification to get users to take action and make the map even more alive. Check it out at [utopia-game.org](https://utopia-game.org/) or see the code in the [repository](https://github.com/utopia-os/utopia-game)
|
It is the base of [Utopia Map](https://github.com/utopia-os/utopia-map) and [Utopia Game](https://github.com/utopia-os/utopia-game).
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Interactive Component Map with customizable Layers (like Projects, Event, People)
|
* Interactive Component Map with customizable Layers (like Projects, Event, People)
|
||||||
* Flexible API-Interface to make it work with every backend or p2p database
|
* Flexible API-Interface to make it work with every backend or p2p database
|
||||||
* Create, Update, Delete Items
|
* Create, Update, Delete Items
|
||||||
* User Authentification API-Interface
|
* User authentification API-Interface
|
||||||
* User Profiles
|
* Customizable Profiles for users and other items
|
||||||
* App Shell
|
* App shell with navigation bar and sidebar
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
@ -65,7 +67,7 @@ And can open our first map app in the browser 🙂
|
|||||||
|
|
||||||
### Static Layers
|
### Static Layers
|
||||||
|
|
||||||
Now we add some static layer.
|
Now we add some static content in two layer.
|
||||||
|
|
||||||
First we put some sample data in a new file called `src/sample-data.js`
|
First we put some sample data in a new file called `src/sample-data.js`
|
||||||
|
|
||||||
|
|||||||
13
package-lock.json
generated
13
package-lock.json
generated
@ -45,7 +45,9 @@
|
|||||||
"eslint-import-resolver-typescript": "^3.6.3",
|
"eslint-import-resolver-typescript": "^3.6.3",
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
"eslint-plugin-json": "^3.1.0",
|
"eslint-plugin-json": "^3.1.0",
|
||||||
|
"eslint-plugin-no-catch-all": "^1.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
"eslint-plugin-react": "^7.31.8",
|
"eslint-plugin-react": "^7.31.8",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"eslint-plugin-security": "^3.0.1",
|
"eslint-plugin-security": "^3.0.1",
|
||||||
@ -2372,6 +2374,16 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/eslint-plugin-no-catch-all": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-plugin-no-catch-all/-/eslint-plugin-no-catch-all-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-VkP62jLTmccPrFGN/W6V7a3SEwdtTZm+Su2k4T3uyJirtkm0OMMm97h7qd8pRFAHus/jQg9FpUpLRc7sAylBEQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"eslint": ">=2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/eslint-plugin-prettier": {
|
"node_modules/eslint-plugin-prettier": {
|
||||||
"version": "5.2.1",
|
"version": "5.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz",
|
||||||
@ -2409,7 +2421,6 @@
|
|||||||
"integrity": "sha512-57Zzfw8G6+Gq7axm2Pdo3gW/Rx3h9Yywgn61uE/3elTCOePEHVrn2i5CdfBwA1BLK0Q0WqctICIUSqXZW/VprQ==",
|
"integrity": "sha512-57Zzfw8G6+Gq7axm2Pdo3gW/Rx3h9Yywgn61uE/3elTCOePEHVrn2i5CdfBwA1BLK0Q0WqctICIUSqXZW/VprQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -33,7 +33,9 @@
|
|||||||
"eslint-import-resolver-typescript": "^3.6.3",
|
"eslint-import-resolver-typescript": "^3.6.3",
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
"eslint-plugin-json": "^3.1.0",
|
"eslint-plugin-json": "^3.1.0",
|
||||||
|
"eslint-plugin-no-catch-all": "^1.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
"eslint-plugin-react": "^7.31.8",
|
"eslint-plugin-react": "^7.31.8",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"eslint-plugin-security": "^3.0.1",
|
"eslint-plugin-security": "^3.0.1",
|
||||||
|
|||||||
@ -28,6 +28,7 @@ export const ContextWrapper = ({ children }) => {
|
|||||||
try {
|
try {
|
||||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
location = useLocation()
|
location = useLocation()
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
location = null
|
location = null
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ export function SetNewPasswordPage() {
|
|||||||
|
|
||||||
const onReset = async () => {
|
const onReset = async () => {
|
||||||
const token = window.location.search.split('token=')[1]
|
const token = window.location.search.split('token=')[1]
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(token)
|
console.log(token)
|
||||||
|
|
||||||
await toast.promise(passwordReset(token, password), {
|
await toast.promise(passwordReset(token, password), {
|
||||||
|
|||||||
@ -69,6 +69,7 @@ export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
|||||||
setLoading(false)
|
setLoading(false)
|
||||||
return me
|
return me
|
||||||
} else return undefined
|
} else return undefined
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
return undefined
|
return undefined
|
||||||
|
|||||||
@ -63,7 +63,9 @@ export const SearchControl = () => {
|
|||||||
try {
|
try {
|
||||||
const { data } = await axios.get(`https://photon.komoot.io/api/?q=${value}&limit=5`)
|
const { data } = await axios.get(`https://photon.komoot.io/api/?q=${value}&limit=5`)
|
||||||
setGeoResults(data.features)
|
setGeoResults(data.features)
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,6 +217,7 @@ export const SearchControl = () => {
|
|||||||
)
|
)
|
||||||
.openPopup()
|
.openPopup()
|
||||||
.addEventListener('popupclose', (e) => {
|
.addEventListener('popupclose', (e) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(e.target.remove())
|
console.log(e.target.remove())
|
||||||
})
|
})
|
||||||
if (geo.properties.extent)
|
if (geo.properties.extent)
|
||||||
@ -284,6 +287,7 @@ export const SearchControl = () => {
|
|||||||
)
|
)
|
||||||
.openPopup()
|
.openPopup()
|
||||||
.addEventListener('popupclose', (e) => {
|
.addEventListener('popupclose', (e) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(e.target.remove())
|
console.log(e.target.remove())
|
||||||
})
|
})
|
||||||
map.setView(
|
map.setView(
|
||||||
|
|||||||
@ -70,10 +70,12 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
|||||||
try {
|
try {
|
||||||
await props.layer.api?.updateItem!({ ...formItem, id: props.item.id })
|
await props.layer.api?.updateItem!({ ...formItem, id: props.item.id })
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
if (success) {
|
if (success) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(props.item)
|
console.log(props.item)
|
||||||
|
|
||||||
updateItem({ ...props.item, ...formItem })
|
updateItem({ ...props.item, ...formItem })
|
||||||
@ -100,6 +102,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
|||||||
name: formItem.name ? formItem.name : user?.first_name,
|
name: formItem.name ? formItem.name : user?.first_name,
|
||||||
}))
|
}))
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,6 +63,7 @@ export const ItemViewPopup = forwardRef((props: ItemViewPopupProps, ref: any) =>
|
|||||||
props.item.layer?.onlyOnePerOwner &&
|
props.item.layer?.onlyOnePerOwner &&
|
||||||
(await props.item.layer.api?.updateItem!({ id: props.item.id, position: null }))
|
(await props.item.layer.api?.updateItem!({ id: props.item.id, position: null }))
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,6 +94,7 @@ export function UtopiaMapInner({
|
|||||||
useMapEvents({
|
useMapEvents({
|
||||||
click: (e) => {
|
click: (e) => {
|
||||||
resetMetaTags()
|
resetMetaTags()
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(e.latlng.lat + ',' + e.latlng.lng)
|
console.log(e.latlng.lat + ',' + e.latlng.lng)
|
||||||
if (selectNewItemPosition) {
|
if (selectNewItemPosition) {
|
||||||
setMapClicked({ position: e.latlng, setItemFormPopup })
|
setMapClicked({ position: e.latlng, setItemFormPopup })
|
||||||
|
|||||||
@ -89,6 +89,7 @@ function useSelectPositionManager(): {
|
|||||||
position: null,
|
position: null,
|
||||||
})
|
})
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -113,6 +114,7 @@ function useSelectPositionManager(): {
|
|||||||
position: updatedItem.position,
|
position: updatedItem.position,
|
||||||
})
|
})
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -134,6 +136,7 @@ function useSelectPositionManager(): {
|
|||||||
try {
|
try {
|
||||||
await markerClicked.layer?.api?.updateItem!(updatedItem)
|
await markerClicked.layer?.api?.updateItem!(updatedItem)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,11 +60,15 @@ export function ProfileView({ attestationApi }: { attestationApi?: ItemsApi<any>
|
|||||||
attestationApi
|
attestationApi
|
||||||
.getItems()
|
.getItems()
|
||||||
.then((value) => {
|
.then((value) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(value)
|
console.log(value)
|
||||||
|
|
||||||
setAttestations(value)
|
setAttestations(value)
|
||||||
|
return null
|
||||||
})
|
})
|
||||||
|
// eslint-disable-next-line promise/prefer-await-to-callbacks
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error('Error fetching items:', error)
|
console.error('Error fetching items:', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ export const ContactInfoView = ({ item, heading }: { item: Item; heading: string
|
|||||||
const items = useItems()
|
const items = useItems()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(
|
console.log(
|
||||||
'user:',
|
'user:',
|
||||||
items.find(
|
items.find(
|
||||||
|
|||||||
@ -30,6 +30,7 @@ export const GroupSubheaderForm = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (groupTypes && groupStates) {
|
if (groupTypes && groupStates) {
|
||||||
const groupType = groupTypes.find((gt) => gt.groupTypes_id.name === state.group_type)
|
const groupType = groupTypes.find((gt) => gt.groupTypes_id.name === state.group_type)
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(state.group_type)
|
console.log(state.group_type)
|
||||||
setState((prevState) => ({
|
setState((prevState) => ({
|
||||||
...prevState,
|
...prevState,
|
||||||
|
|||||||
@ -16,7 +16,9 @@ const SocialShareBar = ({
|
|||||||
.writeText(url)
|
.writeText(url)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toast.success('link copied to clipboard')
|
toast.success('link copied to clipboard')
|
||||||
|
return null
|
||||||
})
|
})
|
||||||
|
// eslint-disable-next-line promise/prefer-await-to-callbacks
|
||||||
.catch((error: never) => {
|
.catch((error: never) => {
|
||||||
toast.error('Fehler beim Kopieren des Links: ', error)
|
toast.error('Fehler beim Kopieren des Links: ', error)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -17,6 +17,7 @@ const componentMap = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const FlexView = ({ item }: { item: Item }) => {
|
export const FlexView = ({ item }: { item: Item }) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(item)
|
console.log(item)
|
||||||
return (
|
return (
|
||||||
<div className='tw-h-full tw-overflow-y-auto fade'>
|
<div className='tw-h-full tw-overflow-y-auto fade'>
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
|
||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
@ -43,6 +42,9 @@ export function UserSettings() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(() => navigate('/'))
|
.then(() => navigate('/'))
|
||||||
|
.catch((e) => {
|
||||||
|
throw e
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import { encodeTag } from '#utils/FormatTags'
|
|||||||
import { hashTagRegex } from '#utils/HashTagRegex'
|
import { hashTagRegex } from '#utils/HashTagRegex'
|
||||||
import { randomColor } from '#utils/RandomColor'
|
import { randomColor } from '#utils/RandomColor'
|
||||||
|
|
||||||
|
// eslint-disable-next-line promise/avoid-new
|
||||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
||||||
|
|
||||||
export const submitNewItem = async (
|
export const submitNewItem = async (
|
||||||
@ -62,6 +63,7 @@ export const submitNewItem = async (
|
|||||||
await layer?.api?.createItem!({ ...formItem, id: uuid, type, parent: item.id })
|
await layer?.api?.createItem!({ ...formItem, id: uuid, type, parent: item.id })
|
||||||
await linkItem(uuid)
|
await linkItem(uuid)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -83,6 +85,7 @@ export const linkItem = async (id: string, item, updateItem) => {
|
|||||||
try {
|
try {
|
||||||
await item?.layer?.api?.updateItem!(updatedItem)
|
await item?.layer?.api?.updateItem!(updatedItem)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -100,6 +103,7 @@ export const unlinkItem = async (id: string, item, updateItem) => {
|
|||||||
try {
|
try {
|
||||||
await item?.layer?.api?.updateItem!(updatedItem)
|
await item?.layer?.api?.updateItem!(updatedItem)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -123,6 +127,7 @@ export const handleDelete = async (
|
|||||||
try {
|
try {
|
||||||
await item.layer?.api?.deleteItem!(item.id)
|
await item.layer?.api?.deleteItem!(item.id)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -243,6 +248,7 @@ export const onUpdateItem = async (
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
navigate(`/item/${item.id}${params && '?' + params}`)
|
navigate(`/item/${item.id}${params && '?' + params}`)
|
||||||
|
return null
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
item.new = false
|
item.new = false
|
||||||
@ -272,6 +278,7 @@ export const onUpdateItem = async (
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
navigate(`/${params && '?' + params}`)
|
navigate(`/${params && '?' + params}`)
|
||||||
|
return null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,6 +56,7 @@ export const MarketView = () => {
|
|||||||
})
|
})
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(offers)
|
console.log(offers)
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
|||||||
@ -91,6 +91,7 @@ export const OverlayItemsIndexPage = ({
|
|||||||
try {
|
try {
|
||||||
await layer?.api?.createItem!({ ...formItem, id: uuid })
|
await layer?.api?.createItem!({ ...formItem, id: uuid })
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -108,6 +109,7 @@ export const OverlayItemsIndexPage = ({
|
|||||||
try {
|
try {
|
||||||
await layer?.api?.deleteItem!(item.id)
|
await layer?.api?.deleteItem!(item.id)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,9 @@ export async function reverseGeocode(lat: number, lon: number): Promise<string>
|
|||||||
// Formatiere die Adresse
|
// Formatiere die Adresse
|
||||||
const formattedAddress = `${street} ${houseNumber}, ${city}`.trim()
|
const formattedAddress = `${street} ${houseNumber}, ${city}`.trim()
|
||||||
return formattedAddress || ''
|
return formattedAddress || ''
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error('Error:', error)
|
console.error('Error:', error)
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user