Skip to content

Commit

Permalink
lintエラー解消
Browse files Browse the repository at this point in the history
  • Loading branch information
MurakawaTakuya committed Nov 21, 2024
1 parent 7a86bfc commit 38a3f71
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 48 deletions.
1 change: 1 addition & 0 deletions src/app/Components/Uploader/Uploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const ImageUploader: React.FC = () => {
return;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
uploadImage(
image,
(percent) => setProgress(percent),
Expand Down
4 changes: 2 additions & 2 deletions src/app/Components/UserForm/UserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export default function UserForm() {
await signOut(auth);
console.log("Signed out");
} catch (error) {
console.error("errorCode:", (error as any)?.errorCode);
console.error("errorMessage:", (error as any)?.errorMessage);
console.error("errorCode:", (error as Error)?.name);
console.error("errorMessage:", (error as Error)?.message);
}
};

Expand Down
1 change: 0 additions & 1 deletion src/app/firebase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import {
Expand Down
34 changes: 15 additions & 19 deletions src/utils/createUserAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,21 @@
* @param {string} uid
*/
export const createUserAPI = async (name: string, uid: string) => {
try {
const response = await fetch(
"http://127.0.0.1:5001/todo-real-c28fa/asia-northeast1/firestore/user/",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ uid, name }),
}
);

if (!response.ok) {
new Error("Network response was not ok");
const response = await fetch(
"http://127.0.0.1:5001/todo-real-c28fa/asia-northeast1/firestore/user/",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ uid, name }),
}
const data = await response.json();
console.log("Successfully created user");
// console.log("Success:", data);
} catch (error) {
throw error;
);

if (!response.ok) {
new Error("Network response was not ok");
}
console.log("Successfully created user");
// const data = await response.json();
// console.log("Success:", data);
};
4 changes: 2 additions & 2 deletions src/utils/createUserAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const createUser = (email: string, password: string, name: string) => {
// TODO: ログイン状態の維持
})
.catch((error) => {
console.error("errorCode:", (error as any)?.errorCode);
console.error("errorMessage:", (error as any)?.errorMessage);
console.error("errorCode:", (error as Error)?.name);
console.error("errorMessage:", (error as Error)?.message);
});
};
30 changes: 13 additions & 17 deletions src/utils/fetchUserAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@ export /**
* @return {*} {Promise<User>}
*/
const fetchUserAPI = async (uid: string): Promise<User> => {
try {
const response = await fetch(
`http://127.0.0.1:5001/todo-real-c28fa/asia-northeast1/firestore/user/id/${uid}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
);

if (!response.ok) {
new Error("Network response was not ok");
const response = await fetch(
`http://127.0.0.1:5001/todo-real-c28fa/asia-northeast1/firestore/user/id/${uid}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
const data = await response.json();
return data;
} catch (error) {
throw error;
);

if (!response.ok) {
new Error("Network response was not ok");
}
const data = await response.json();
return data;
};
4 changes: 2 additions & 2 deletions src/utils/loginUserAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const loginUser = (email: string, password: string) => {
console.log(user.uid, userData);
})
.catch((error) => {
console.error("errorCode:", (error as any)?.errorCode);
console.error("errorMessage:", (error as any)?.errorMessage);
console.error("errorCode:", (error as Error)?.name);
console.error("errorMessage:", (error as Error)?.message);
});
return null;
};
7 changes: 4 additions & 3 deletions src/utils/signInAnonymously.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import { signInAnonymously } from "firebase/auth";
*/
export const signInAsGuest = async () => {
try {
const result = await signInAnonymously(auth);
await signInAnonymously(auth);
// const result = await signInAnonymously(auth);
// console.log("Guest login successful:", result.user);
console.log("Guest login successful");
} catch (error) {
console.error("errorCode:", (error as any)?.errorCode);
console.error("errorMessage:", (error as any)?.errorMessage);
console.error("errorCode:", (error as Error)?.name);
console.error("errorMessage:", (error as Error)?.message);
}
};
4 changes: 2 additions & 2 deletions src/utils/signInWithGoogleAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const signInWithGoogleAccount = async () => {
console.log("Google login successful");
// console.log("Google login successful:", result.user);
} catch (error) {
console.error("errorCode:", (error as any)?.errorCode);
console.error("errorMessage:", (error as any)?.errorMessage);
console.error("errorCode:", (error as Error)?.name);
console.error("errorMessage:", (error as Error)?.message);
}
};

0 comments on commit 38a3f71

Please sign in to comment.