Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add:sads #1 #2

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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