Use showError for errors
parent
69fb546cf2
commit
9aa4dd7a20
|
@ -10,6 +10,7 @@
|
|||
"license": "agpl",
|
||||
"dependencies": {
|
||||
"@nextcloud/l10n": "^1.6.0",
|
||||
"@nextcloud/paths": "^2.1.0",
|
||||
"@nextcloud/vue": "^6.0.0-beta.6",
|
||||
"path-posix": "^1.0.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
|
@ -2217,6 +2218,14 @@
|
|||
"core-js": "^3.6.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@nextcloud/paths": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@nextcloud/paths/-/paths-2.1.0.tgz",
|
||||
"integrity": "sha512-8wX0gqwez0bTuAS8A0OEiqbbp0ZsqLr07zSErmS6OYhh9KZcSt/kO6lQV5tnrFqIqJVsxwz4kHUjtZXh6DSf9Q==",
|
||||
"dependencies": {
|
||||
"core-js": "^3.6.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@nextcloud/router": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-2.0.0.tgz",
|
||||
|
@ -13596,6 +13605,14 @@
|
|||
"core-js": "^3.6.4"
|
||||
}
|
||||
},
|
||||
"@nextcloud/paths": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@nextcloud/paths/-/paths-2.1.0.tgz",
|
||||
"integrity": "sha512-8wX0gqwez0bTuAS8A0OEiqbbp0ZsqLr07zSErmS6OYhh9KZcSt/kO6lQV5tnrFqIqJVsxwz4kHUjtZXh6DSf9Q==",
|
||||
"requires": {
|
||||
"core-js": "^3.6.4"
|
||||
}
|
||||
},
|
||||
"@nextcloud/router": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-2.0.0.tgz",
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@nextcloud/l10n": "^1.6.0",
|
||||
"@nextcloud/paths": "^2.1.0",
|
||||
"@nextcloud/vue": "^6.0.0-beta.6",
|
||||
"path-posix": "^1.0.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
|
|
|
@ -39,9 +39,10 @@
|
|||
import { Component, Prop, Emit, Mixins } from 'vue-property-decorator';
|
||||
import { IDay, IPhoto } from "../types";
|
||||
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
import { getPreviewUrl } from "../services/FileUtils";
|
||||
import * as dav from "../services/DavRequests";
|
||||
import errorsvg from "../assets/error.svg";
|
||||
import { getPreviewUrl } from "../services/FileUtils";
|
||||
import GlobalMixin from '../mixins/GlobalMixin';
|
||||
|
||||
@Component({})
|
||||
|
@ -132,7 +133,7 @@ export default class Photo extends Mixins(GlobalMixin) {
|
|||
// Get this photo in the fileInfos
|
||||
const photo = fileInfos.find(d => Number(d.fileid) === Number(this.data.fileid));
|
||||
if (!photo) {
|
||||
alert('Cannot find this photo anymore!');
|
||||
showError('Cannot find this photo anymore!');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ input[type=text] {
|
|||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator';
|
||||
import GlobalMixin from '../mixins/GlobalMixin';
|
||||
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
import UserConfig from '../mixins/UserConfig'
|
||||
|
||||
@Component
|
||||
|
@ -51,7 +53,7 @@ export default class Settings extends Mixins(UserConfig, GlobalMixin) {
|
|||
if (res.status === 200) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert('Error updating settings');
|
||||
showError('Error updating settings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
import { getCurrentUser } from '@nextcloud/auth'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import { encodePath } from '@nextcloud/paths'
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
|
||||
import { genFileInfo } from './FileUtils'
|
||||
import client from './DavClient';
|
||||
import { IFileInfo } from '../types';
|
||||
import axios from '@nextcloud/axios'
|
||||
import client from './DavClient';
|
||||
|
||||
const props = `
|
||||
<oc:fileid />
|
||||
|
@ -192,6 +196,7 @@ export async function* deleteFilesByIds(fileIds: number[]) {
|
|||
try {
|
||||
fileInfos = await getFiles(fileIds.filter(f => f));
|
||||
} catch (e) {
|
||||
showError(t('photos', 'Failed to delete files.'));
|
||||
console.error('Failed to get file info for files to delete', fileIds, e);
|
||||
return;
|
||||
}
|
||||
|
@ -202,8 +207,9 @@ export async function* deleteFilesByIds(fileIds: number[]) {
|
|||
try {
|
||||
await deleteFile(fileInfo.filename);
|
||||
return fileInfo.fileid as number;
|
||||
} catch {
|
||||
console.error('Failed to delete', fileInfo.filename)
|
||||
} catch (error) {
|
||||
console.error(t('photos', 'Failed to delete {fileName}.', fileInfo), error);
|
||||
showError(t('photos', 'Failed to delete {fileName}.', fileInfo));
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue