diff --git a/resources/assets/src/scripts/hooks/useTexture.ts b/resources/assets/src/scripts/hooks/useTexture.ts index 2f861663..74843997 100644 --- a/resources/assets/src/scripts/hooks/useTexture.ts +++ b/resources/assets/src/scripts/hooks/useTexture.ts @@ -2,8 +2,6 @@ import { useState, useEffect } from 'react' import * as fetch from '../net' import { Texture, TextureType } from '../types' -type Response = fetch.ResponseBody - export default function useTexture() { const [tid, setTid] = useState(0) const [url, setUrl] = useState('') @@ -16,9 +14,7 @@ export default function useTexture() { } const getTexture = async () => { - const { - data: { hash, type }, - } = await fetch.get(`/skinlib/info/${tid}`) + const { hash, type } = await fetch.get(`/skinlib/info/${tid}`) setUrl(`${blessing.base_url}/textures/${hash}`) setType(type) diff --git a/resources/assets/tests/views/user/Players.test.tsx b/resources/assets/tests/views/user/Players.test.tsx index 7e1eda9e..f83fe678 100644 --- a/resources/assets/tests/views/user/Players.test.tsx +++ b/resources/assets/tests/views/user/Players.test.tsx @@ -66,8 +66,8 @@ describe('select player automatically', () => { it('only one player', async () => { fetch.get .mockResolvedValueOnce([fixture]) - .mockResolvedValueOnce({ data: { hash: '', type: TextureType.Steve } }) - .mockResolvedValueOnce({ data: { hash: '', type: TextureType.Cape } }) + .mockResolvedValueOnce({ hash: '', type: TextureType.Steve }) + .mockResolvedValueOnce({ hash: '', type: TextureType.Cape }) render() await waitFor(() => expect(fetch.get).toBeCalledTimes(1)) @@ -97,8 +97,8 @@ describe('2d preview', () => { it('skin and cape', async () => { fetch.get .mockResolvedValueOnce([fixture]) - .mockResolvedValueOnce({ data: { hash: 'a', type: TextureType.Steve } }) - .mockResolvedValueOnce({ data: { hash: 'b', type: TextureType.Cape } }) + .mockResolvedValueOnce({ hash: 'a', type: TextureType.Steve }) + .mockResolvedValueOnce({ hash: 'b', type: TextureType.Cape }) const { getByAltText, getByText } = render() await waitFor(() => expect(fetch.get).toBeCalledTimes(1)) @@ -118,7 +118,7 @@ describe('2d preview', () => { it('skin only', async () => { fetch.get .mockResolvedValueOnce([{ ...fixture, tid_cape: 0 }]) - .mockResolvedValueOnce({ data: { hash: 'a', type: TextureType.Steve } }) + .mockResolvedValueOnce({ hash: 'a', type: TextureType.Steve }) const { getByAltText, queryByAltText, getByText, queryByText } = render( , @@ -138,7 +138,7 @@ describe('2d preview', () => { it('cape only', async () => { fetch.get .mockResolvedValueOnce([{ ...fixture, tid_skin: 0 }]) - .mockResolvedValueOnce({ data: { hash: 'a', type: TextureType.Cape } }) + .mockResolvedValueOnce({ hash: 'a', type: TextureType.Cape }) const { getByAltText, queryByAltText, getByText, queryByText } = render( , @@ -265,8 +265,8 @@ describe('edit player name', () => { beforeEach(() => { fetch.get .mockResolvedValueOnce([fixture]) - .mockResolvedValueOnce({ data: { hash: 'a', type: 'skin' } }) - .mockResolvedValueOnce({ data: { hash: 'b', type: TextureType.Cape } }) + .mockResolvedValueOnce({ hash: 'a', type: 'skin' }) + .mockResolvedValueOnce({ hash: 'b', type: TextureType.Cape }) }) it('succeeded', async () => { @@ -346,8 +346,8 @@ describe('reset texture', () => { beforeEach(() => { fetch.get .mockResolvedValueOnce([fixture]) - .mockResolvedValueOnce({ data: { hash: 'a', type: 'skin' } }) - .mockResolvedValueOnce({ data: { hash: 'b', type: TextureType.Cape } }) + .mockResolvedValueOnce({ hash: 'a', type: 'skin' }) + .mockResolvedValueOnce({ hash: 'b', type: TextureType.Cape }) }) it('clear skin and cape', async () => { @@ -457,8 +457,8 @@ describe('delete player', () => { beforeEach(() => { fetch.get .mockResolvedValueOnce([fixture]) - .mockResolvedValueOnce({ data: { hash: 'a', type: 'skin' } }) - .mockResolvedValueOnce({ data: { hash: 'b', type: TextureType.Cape } }) + .mockResolvedValueOnce({ hash: 'a', type: 'skin' }) + .mockResolvedValueOnce({ hash: 'b', type: TextureType.Cape }) }) it('succeeded', async () => {