Skip to content

Commit

Permalink
feat: add zustand store
Browse files Browse the repository at this point in the history
  • Loading branch information
eun-hak committed May 16, 2024
1 parent 21d3443 commit 0eaa027
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/api/auth/auth.post.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const signup = async ({
memberPhone,
memberSmsAgree
});
//retrun nll 처리를 하면 react query의 onSuccess 작동
return response;
};

Expand Down
28 changes: 28 additions & 0 deletions src/stores/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { create } from 'zustand';
import { persist } from 'zustand/middleware';

/* eslint-disable no-unused-vars */

interface IMember {
member: object;
setmember: (payload: string) => void;
}

export const useMemberStore = create(
persist<IMember>(
(set) => ({
member: { job: '' },
setmember: (payload: string) =>
set((state) => ({
...state,
member: {
...state.member,
job: payload
}
}))
}),
{
name: 'job'
}
)
);

0 comments on commit 0eaa027

Please sign in to comment.