mirror of
https://github.com/diced/zipline.git
synced 2026-01-10 20:24:16 -08:00
Removed viewing all users images (bug)
This commit is contained in:
@@ -96,18 +96,12 @@ export class APIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Get('images')
|
||||
private async images(req: Request, res: Response) {
|
||||
const all = await this.orm.repos.image.find();
|
||||
return res.status(200).json(all)
|
||||
}
|
||||
|
||||
@Get('images')
|
||||
@Get('images/user')
|
||||
@Middleware(cookiesForAPI)
|
||||
private async imagesUser(req: Request, res: Response) {
|
||||
const userId = req.query.user;
|
||||
const all = await this.orm.repos.image.find({ where: { user: userId }, order: { id: 'ASC' }});
|
||||
return res.status(200).json(all)
|
||||
const all = await this.orm.repos.image.find({ where: { user: req.session.user.id }, order: { id: 'ASC' } });
|
||||
return res.status(200).json(all);
|
||||
}
|
||||
|
||||
@Delete('images')
|
||||
|
||||
@@ -209,18 +209,18 @@
|
||||
|
||||
document.getElementById('updateImages').addEventListener('click', async () => {
|
||||
document.getElementById('typexImages').innerHTML = '';
|
||||
const res = await fetch('/api/images?user=' + "<%=user.id%>", {
|
||||
const res = await fetch('/api/images/user', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
try {
|
||||
const json = await res.json();
|
||||
if (json.error || json.code) return showAlert('error', json.error)
|
||||
else {
|
||||
json.forEach(image => {
|
||||
$('#typexImages').append(`
|
||||
try {
|
||||
const json = await res.json();
|
||||
if (json.error || json.code) return showAlert('error', json.error)
|
||||
else {
|
||||
json.forEach(image => {
|
||||
$('#typexImages').append(`
|
||||
<div class="card typex-image-actions typex-image-buttons"
|
||||
style="background-color: transparent;">
|
||||
<img class="card-img-top" src="${image.url}" onclick="window.location.href='${image.url}'"/>
|
||||
@@ -228,11 +228,11 @@
|
||||
value="${image.id}" />
|
||||
</div>
|
||||
`)
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
});
|
||||
|
||||
const copyText = (text) => {
|
||||
|
||||
Reference in New Issue
Block a user