Skip to content

Commit

Permalink
fix: fix broken create button
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Ottun committed Sep 28, 2021
1 parent cf95926 commit fcfa5c1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ui/src/components/mocks/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export const EditMockProvider = ({ children }) => {
const api = mock();
const [state, setState] = useState<{ mock?: Mock; error: any }>({ error: null });

const createMock = (mock: Mock) => {
setState({ mock, error: null });
};

const deleteMock = async (mock: Mock) => {
try {
await api.delete(Yaml.stringify(mock));
Expand Down Expand Up @@ -102,6 +106,7 @@ export const EditMockProvider = ({ children }) => {
clone: cloneMock,
delete: deleteMock,
update: updateMock,
create: createMock,
clear: clearRecords,
reset: resetServer,
}}
Expand Down

0 comments on commit fcfa5c1

Please sign in to comment.