mirror of https://github.com/nextcloud/server
chore(files_sharing): use `OCSResponse` from `@nextcloud/typings`
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
This commit is contained in:
parent
f1c79cd264
commit
7b95811290
|
@ -21,8 +21,8 @@
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line n/no-extraneous-import
|
// eslint-disable-next-line n/no-extraneous-import
|
||||||
import type { AxiosResponse } from 'axios'
|
import type { AxiosResponse } from 'axios'
|
||||||
import type { OCSResponse } from '../../../files_sharing/src/services/SharingService'
|
|
||||||
import type { ContentsWithRoot } from '@nextcloud/files'
|
import type { ContentsWithRoot } from '@nextcloud/files'
|
||||||
|
import type { OCSResponse } from '@nextcloud/typings/ocs'
|
||||||
|
|
||||||
import { Folder, Permission } from '@nextcloud/files'
|
import { Folder, Permission } from '@nextcloud/files'
|
||||||
import { generateOcsUrl, generateRemoteUrl, generateUrl } from '@nextcloud/router'
|
import { generateOcsUrl, generateRemoteUrl, generateUrl } from '@nextcloud/router'
|
||||||
|
@ -83,7 +83,7 @@ const entryToFolder = (ocsEntry: MountEntry): Folder => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getContents = async (): Promise<ContentsWithRoot> => {
|
export const getContents = async (): Promise<ContentsWithRoot> => {
|
||||||
const response = await axios.get(generateOcsUrl('apps/files_external/api/v1/mounts')) as AxiosResponse<OCSResponse<MountEntry>>
|
const response = await axios.get(generateOcsUrl('apps/files_external/api/v1/mounts')) as AxiosResponse<OCSResponse<MountEntry[]>>
|
||||||
const contents = response.data.ocs.data.map(entryToFolder)
|
const contents = response.data.ocs.data.map(entryToFolder)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -19,12 +19,13 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import type { OCSResponse } from '@nextcloud/typings/ocs'
|
||||||
import { expect } from '@jest/globals'
|
import { expect } from '@jest/globals'
|
||||||
import axios from '@nextcloud/axios'
|
|
||||||
import { Type } from '@nextcloud/sharing'
|
import { Type } from '@nextcloud/sharing'
|
||||||
import * as auth from '@nextcloud/auth'
|
import * as auth from '@nextcloud/auth'
|
||||||
|
import axios from '@nextcloud/axios'
|
||||||
|
|
||||||
import { getContents, type OCSResponse } from './SharingService'
|
import { getContents } from './SharingService'
|
||||||
import { File, Folder } from '@nextcloud/files'
|
import { File, Folder } from '@nextcloud/files'
|
||||||
import logger from './logger'
|
import logger from './logger'
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
/* eslint-disable camelcase, n/no-extraneous-import */
|
/* eslint-disable camelcase, n/no-extraneous-import */
|
||||||
import type { AxiosPromise } from 'axios'
|
import type { AxiosPromise } from 'axios'
|
||||||
|
import type { OCSResponse } from '@nextcloud/typings/ocs'
|
||||||
|
|
||||||
import { Folder, File, type ContentsWithRoot } from '@nextcloud/files'
|
import { Folder, File, type ContentsWithRoot } from '@nextcloud/files'
|
||||||
import { generateOcsUrl, generateRemoteUrl } from '@nextcloud/router'
|
import { generateOcsUrl, generateRemoteUrl } from '@nextcloud/router'
|
||||||
|
@ -31,17 +32,6 @@ import logger from './logger'
|
||||||
|
|
||||||
export const rootPath = `/files/${getCurrentUser()?.uid}`
|
export const rootPath = `/files/${getCurrentUser()?.uid}`
|
||||||
|
|
||||||
export type OCSResponse<T> = {
|
|
||||||
ocs: {
|
|
||||||
meta: {
|
|
||||||
status: string
|
|
||||||
statuscode: number
|
|
||||||
message: string
|
|
||||||
},
|
|
||||||
data: T[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/* eslint-disable n/no-extraneous-import */
|
/* eslint-disable n/no-extraneous-import */
|
||||||
|
import type { OCSResponse } from '@nextcloud/typings/ocs'
|
||||||
import { expect } from '@jest/globals'
|
import { expect } from '@jest/globals'
|
||||||
import { Folder, Navigation, View, getNavigation } from '@nextcloud/files'
|
import { Folder, Navigation, View, getNavigation } from '@nextcloud/files'
|
||||||
import axios from '@nextcloud/axios'
|
import axios from '@nextcloud/axios'
|
||||||
|
|
||||||
import '../main'
|
import '../main'
|
||||||
import { type OCSResponse } from '../services/SharingService'
|
|
||||||
import registerSharingViews from './shares'
|
import registerSharingViews from './shares'
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue