Skip to content

Commit

Permalink
プロフィール編集APIを叩く処理を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
takecchi committed Dec 13, 2023
1 parent 0088316 commit e791a08
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
},
"dependencies": {
"@cuculus/cuculus-api": "^0.4.0",
"@cuculus/cuculus-api": "^0.4.1",
"@ducanh2912/next-pwa": "^9.7.1",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
Expand Down
25 changes: 13 additions & 12 deletions src/swr/client/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,26 @@ const update = async (
key: SWRKey,
{ arg }: { arg: Arg },
): Promise<UserWithFollows> => {
const headers = {
...(await getAuthorizationHeader(key.authId)),
// 'Content-Type': 'application/json',
};
const headers = await getAuthorizationHeader(key.authId);

let user: UserWithFollows | undefined = undefined;

if (arg.profileImage) {
user = await accountsApi.updateProfileImage(
{ file: arg.profileImage },
{ headers },
);
}
if (arg.bio || arg.name) {
// TODO SDKの更新待ち
user = await accountsApi.updateProfile(
{
updateProfile: { name: arg.name, bio: arg.bio as unknown as object },
updateProfile: { name: arg.name, bio: arg.bio },
},
{
headers: {
...headers,
'Content-Type': 'application/json',
},
},
);
}
if (arg.profileImage) {
user = await accountsApi.updateProfileImage(
{ file: arg.profileImage },
{ headers },
);
}
Expand Down

0 comments on commit e791a08

Please sign in to comment.