Replace _id by id

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-05-05 17:58:05 +04:00
parent 3a21a6abee
commit 51879ba5aa
11 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -102,7 +102,7 @@ export default function MizikBadjMeni({teks}) {
<Paper> <Paper>
<ClickAwayListener onClickAway={handleClose}> <ClickAwayListener onClickAway={handleClose}>
<MenuList autoFocusItem={open} id='menu-list-grow' onKeyDown={() => handleListKeyDown()}> <MenuList autoFocusItem={open} id='menu-list-grow' onKeyDown={() => handleListKeyDown()}>
{teks.map(t => <MenuItem key={t._id} onClick={() => handleClick(t.slug)}>{t.tit}</MenuItem>)} {teks.map(t => <MenuItem key={t.id} onClick={() => handleClick(t.slug)}>{t.tit}</MenuItem>)}
</MenuList> </MenuList>
</ClickAwayListener> </ClickAwayListener>
</Paper> </Paper>
+3 -3
View File
@@ -18,7 +18,7 @@ const Alert = forwardRef(function Alert(props, ref) {
}) })
function EkriKomante({session, teks, meteEsKomanteOuve}) { function EkriKomante({session, teks, meteEsKomanteOuve}) {
const {jwt, user} = session const {jwt, user} = session
const {_id} = teks const {id} = teks
const [komante, meteKomante] = useState({kontni: ''}) const [komante, meteKomante] = useState({kontni: ''})
const [ere, meteEre] = useState('') const [ere, meteEre] = useState('')
const [sikse, meteSikse] = useState('') const [sikse, meteSikse] = useState('')
@@ -43,8 +43,8 @@ function EkriKomante({session, teks, meteEsKomanteOuve}) {
axios.post(`${API_URL}/komante`, { axios.post(`${API_URL}/komante`, {
kontni, kontni,
teks: _id, teks: id,
user: user._id user: user.id
}, { }, {
headers headers
}) })
+2 -2
View File
@@ -38,8 +38,8 @@ const StyledList = styled(List)((
export default function KomanteList({komante}) { export default function KomanteList({komante}) {
return ( return (
<StyledList className={classes.root}> <StyledList className={classes.root}>
{komante.map(({_id, username, kontni, sentAt}) => ( {komante.map(({id, username, kontni, sentAt}) => (
<div key={_id}> <div key={id}>
<ListItemText <ListItemText
primary={ primary={
<Typography gutterBottom style={{fontWeight: 'bold'}} variant='body1'> <Typography gutterBottom style={{fontWeight: 'bold'}} variant='body1'>
+1 -1
View File
@@ -26,7 +26,7 @@ export default function ResetDialog({lyen, title, activation, content, open, set
if (activation) { if (activation) {
const user = await jwennUserEpiEmail(email) const user = await jwennUserEpiEmail(email)
localStorage.setItem('user-id', user?._id) localStorage.setItem('user-id', user?.id)
} }
setLoading(false) setLoading(false)
+1 -1
View File
@@ -102,7 +102,7 @@ function Koneksyon({chimen}) {
'content-type': 'application/json' 'content-type': 'application/json'
} }
}) })
localStorage.setItem('user-id', response?.data?.user?._id) localStorage.setItem('user-id', response?.data?.user?.id)
setSuccess(true) setSuccess(true)
resetRegisterForm() resetRegisterForm()
} catch (error_) { } catch (error_) {
+4 -4
View File
@@ -37,8 +37,8 @@ function Chwa(props) {
</Container> </Container>
) : ( ) : (
<List sx={{pt: 0}}> <List sx={{pt: 0}}>
{teksLis.length > 0 ? teksLis.map(({_id, tit, awtis}) => ( {teksLis.length > 0 ? teksLis.map(({id, tit, awtis}) => (
<ListItem key={_id} button onClick={() => handleListItemClick(_id)}> <ListItem key={id} button onClick={() => handleListItemClick(id)}>
<ListItemAvatar> <ListItemAvatar>
<Avatar sx={{bgcolor: green[100], color: green[600]}}> <Avatar sx={{bgcolor: green[100], color: green[600]}}>
<AudiotrackIcon /> <AudiotrackIcon />
@@ -78,14 +78,14 @@ export default function ChwaTeks({selectedTeks, setSelectedTeks}) {
setOpen(true) setOpen(true)
setLoading(true) setLoading(true)
const jwennTeks = await jwennTeksEpiUserId(user._id) const jwennTeks = await jwennTeksEpiUserId(user.id)
setTeksLis(jwennTeks) setTeksLis(jwennTeks)
setLoading(false) setLoading(false)
} }
const handleClose = value => { const handleClose = value => {
const teks = teksLis.find(({_id}) => _id === value) const teks = teksLis.find(({id}) => id === value)
setSelectedTeks(teks) setSelectedTeks(teks)
setOpen(false) setOpen(false)
} }
+3 -3
View File
@@ -128,7 +128,7 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
if (currentTeksId) { if (currentTeksId) {
axios.get(`${API_URL}/teks/${currentTeksId}?_publicationState=preview&_where[published_at_null]=true`) axios.get(`${API_URL}/teks/${currentTeksId}?_publicationState=preview&_where[published_at_null]=true`)
.then(awtisResponse => { .then(awtisResponse => {
if (awtisResponse.data.user._id !== user._id) { if (awtisResponse.data.user.id !== user.id) {
setLoading(false) setLoading(false)
return setError({message: 'Opération non autorisée'}) return setError({message: 'Opération non autorisée'})
} }
@@ -182,7 +182,7 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
italiano: it === '' ? null : it italiano: it === '' ? null : it
}, },
user, user,
awtis: [awtisResponse.data._id], awtis: [awtisResponse.data.id],
tradiksyonOtomatik tradiksyonOtomatik
}, { }, {
headers headers
@@ -228,7 +228,7 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
useEffect(() => { useEffect(() => {
if (selectedTeks) { if (selectedTeks) {
setTradiksyonOtomatik(false) setTradiksyonOtomatik(false)
setCurrentTeksId(selectedTeks._id) setCurrentTeksId(selectedTeks.id)
setTeksEkri({ setTeksEkri({
awtis: new Intl.ListFormat('fr').format(selectedTeks.awtis.map(({alias}) => alias)), awtis: new Intl.ListFormat('fr').format(selectedTeks.awtis.map(({alias}) => alias)),
tit: selectedTeks.tit, tit: selectedTeks.tit,
+1 -1
View File
@@ -27,7 +27,7 @@ export default function DenyeTeks(teks) {
<Root className={classes.container}> <Root className={classes.container}>
<Container> <Container>
<Grid container spacing={3}> <Grid container spacing={3}>
{teksKlasePaPibilikasyon.map(t => <TeksKat key={t._id} teks={t} />)} {teksKlasePaPibilikasyon.map(t => <TeksKat key={t.id} teks={t} />)}
</Grid> </Grid>
</Container> </Container>
</Root> </Root>
+2 -2
View File
@@ -121,9 +121,9 @@ function EntegreMizik({anTeks, isMobile}) {
return ( return (
<Box align='center'> <Box align='center'>
{!okiMizikID && filteredKouteyAchtey.map(({_id, boutik, url}) => ( {!okiMizikID && filteredKouteyAchtey.map(({id, boutik, url}) => (
<IconButton <IconButton
key={_id} key={id}
aria-label='player' aria-label='player'
size='large' size='large'
onClick={() => handleClick(boutik, url)} onClick={() => handleClick(boutik, url)}
+1 -1
View File
@@ -15,7 +15,7 @@ export default function Awtis({pajTotal, awtisPouChakPaj, paj}) {
<Pajinasyon pajTotal={pajTotal} paj={paj} /> <Pajinasyon pajTotal={pajTotal} paj={paj} />
<Container> <Container>
<Grid container spacing={{xs: 2, md: 3}}> <Grid container spacing={{xs: 2, md: 3}}>
{awtisPouChakPaj.map(anAwtis => <AwtisKat key={anAwtis._id} anAwtis={anAwtis} />)} {awtisPouChakPaj.map(anAwtis => <AwtisKat key={anAwtis.id} anAwtis={anAwtis} />)}
</Grid> </Grid>
</Container> </Container>
</HeadLayout> </HeadLayout>
+2 -2
View File
@@ -55,8 +55,8 @@ export async function getServerSideProps({query}) {
throw new Error('San répons') throw new Error('San répons')
} }
const {_id} = anTeks const {id} = anTeks
const komante = await jwennKomanteEpiTeksId(_id) const komante = await jwennKomanteEpiTeksId(id)
return { return {
props: { props: {