Skip to content

Commit

Permalink
add:sads #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamyzm committed Apr 29, 2024
1 parent 6659d96 commit 8a928eb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions src/app/msw/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';
import React, { useEffect } from 'react';
import { wait } from '@/serverActions';
import Image from 'next/image';

export default function Page() {
async function waitf() {
Expand Down Expand Up @@ -41,6 +42,23 @@ export default function Page() {

return (
<div>
<Image
alt={'img'}
src={''}
width={500}
height={500}
onError={() =>
'/UnY4vuO6nU63HZPVv0C5gOmpcypcEiJ55Jkg-oEFOiaDHrjb5lG_8aLWEdVx6Gb4ltml5CHSRaLC4dcz-YEecgldtzhYmaXFBCLiGubm8cfVTHtF79rUOO65UuaKOa18_JoBGAJiNtHUaT-rBrZOlA.png'
}
/>
<Image
alt={'img'}
src={
'/UnY4vuO6nU63HZPVv0C5gOmpcypcEiJ55Jkg-oEFOiaDHrjb5lG_8aLWEdVx6Gb4ltml5CHSRaLC4dcz-YEecgldtzhYmaXFBCLiGubm8cfVTHtF79rUOO65UuaKOa18_JoBGAJiNtHUaT-rBrZOlA.png'
}
width={500}
height={500}
/>
<div>
<button onClick={fetchData}>fetchData</button>
</div>
Expand Down
12 changes: 5 additions & 7 deletions src/mocks/MswProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ import { useState, useEffect } from 'react';
const isMockingMode = true;

export const MSWComponent = () => {
const [mswReady, setMSWReady] = useState(!isMockingMode);
const [mswReady, setMSWReady] = useState(false);

useEffect(() => {
const init = async () => {
if (isMockingMode) {
// const { initMocks } = await import('./index');
const initMocks = await import('./index').then(res => res.initMocks);
await initMocks();
setMSWReady(true);
}
// const { initMocks } = await import('./index');
const initMocks = await import('./index').then(res => res.initMocks);
await initMocks();
setMSWReady(true);
};

if (!mswReady) {
Expand Down

0 comments on commit 8a928eb

Please sign in to comment.