Skip to content

Commit

Permalink
Merge pull request #182 from moonstream-to/alpha
Browse files Browse the repository at this point in the history
Alpha
  • Loading branch information
Anton-Mushnin authored Mar 27, 2024
2 parents 3169b9d + c0810c8 commit aeff585
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion web/src/contexts/UserContext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ export const UserProvider = ({ children }: { children: React.ReactNode }) => {
return setUser(null);
}
setIsLoading(true);
console.log(token);
const headers = { Authorization: `Bearer ${token}` };
http
.get(`${AUTH_URL}/user`, { headers })
.then(
(response) => {
localStorage.setItem("FULLCOUNT_USER_ID", response.data.user_id);
setUser(response.data);
},
(reason) => {
Expand Down
1 change: 1 addition & 0 deletions web/src/hooks/useLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const useLogin = () => {
return;
}
localStorage.setItem("FULLCOUNT_ACCESS_TOKEN", data.data.id);
localStorage.setItem("FULLCOUNT_USER_ID", data.data.user_id);
sendReport("logged in", variables.username, [`user_token: ${data.data.id}`]);
getUser(data.data.user_id);
},
Expand Down
1 change: 1 addition & 0 deletions web/src/hooks/useSignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const useSignUp = () => {
} = useMutation(registerService(), {
onSuccess: (response, variables) => {
localStorage.setItem("FULLCOUNT_ACCESS_TOKEN", response.data.id);
localStorage.setItem("FULLCOUNT_USER_ID", response.data.user_id);
sendReport("signed up", `${variables.username} - ${variables.email}`, [
`user_token: ${response.data.id}`,
]);
Expand Down
26 changes: 13 additions & 13 deletions web/src/tokenInterfaces/FullcountPlayerAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export async function startSessionFullcountPlayer({
return response.data;
});
sendReport("Session started", `Token #${token.id} started session ${data.session_id}`, [
`token_address: ${token.address}`,
`token_id: ${token.id}`,
`token_address:${token.address}`,
`token_id:${token.id}`,
]);
return { sessionID: data.session_id, sign: "0x" + data.signature };
}
Expand Down Expand Up @@ -157,7 +157,7 @@ export async function joinSessionFullcountPlayer({
sendReport(
"Joining failed",
`${e.message} Token #${token.id} joining session #${sessionID}`,
[`token_address: ${token.address}`, `token_id: ${token.id}`],
[`token_address:${token.address}`, `token_id:${token.id}`],
);
throw e;
});
Expand Down Expand Up @@ -190,8 +190,8 @@ export const unstakeFullcountPlayer = async ({ token }: { token: Token }) => {
})
.catch((e: any) => {
sendReport("Unstaking failed", `${e.message} unstaking token #${token.id}`, [
`token_address: ${token.address}`,
`token_id: ${token.id}`,
`token_address:${token.address}`,
`token_id:${token.id}`,
]);
throw e;
});
Expand Down Expand Up @@ -268,15 +268,15 @@ export const commitOrRevealPitchFullcountPlayer = ({
}
console.log("Success:", response.data);
sendReport(`Move ${isCommit ? "committed" : "revealed"}`, `Token #${token.id}`, [
`token_address: ${token.address}`,
`token_id: ${token.id}`,
`token_address:${token.address}`,
`token_id:${token.id}`,
]);
return response.data;
})
.catch((e: any) => {
sendReport(`${isCommit ? "commit" : "reveal"} failed`, `${e.message} Token #${token.id}`, [
`token_address: ${token.address}`,
`token_id: ${token.id}`,
`token_address:${token.address}`,
`token_id:${token.id}`,
]);
throw e;
});
Expand Down Expand Up @@ -345,15 +345,15 @@ export const commitOrRevealSwingFullcountPlayer = ({
}
console.log("Success:", response.data);
sendReport(`Move ${isCommit ? "committed" : "revealed"}`, `Token #${token.id}`, [
`token_address: ${token.address}`,
`token_id: ${token.id}`,
`token_address:${token.address}`,
`token_id:${token.id}`,
]);
return response.data;
})
.catch((e: any) => {
sendReport(`${isCommit ? "commit" : "reveal"} failed`, `${e.message} Token #${token.id}`, [
`token_address: ${token.address}`,
`token_id: ${token.id}`,
`token_address:${token.address}`,
`token_id:${token.id}`,
]);
throw e;
});
Expand Down
4 changes: 2 additions & 2 deletions web/src/utils/humbug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const info = () => {

const defaultTags = () => {
return [
`client_id: ${localStorage.getItem("FULLCOUNT_ACCESS_TOKEN") ?? ""}`,
`report_version: ${HUMBUG_REPORT_VERSION}`,
`client_id:${localStorage.getItem("FULLCOUNT_USER_ID") ?? ""}`,
`report_version:${HUMBUG_REPORT_VERSION}`,
];
};

0 comments on commit aeff585

Please sign in to comment.