commit f78d3e5dd8e7824bde3d6d8c68346ca2ef2d00ae
parent 764333b820510258492cb426c8a21b3e9fe61f02
Author: MTRNord <mtrnord1@gmail.com>
Date: Mon, 24 Jan 2022 22:25:37 +0100
Minor fixes
Diffstat:
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/.eslintrc.json b/.eslintrc.json
@@ -12,6 +12,7 @@
"jsx-a11y/anchor-is-valid": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/filename-case": "off",
- "unicorn/prefer-ternary": "off"
+ "unicorn/prefer-ternary": "off",
+ "unicorn/no-lonely-if": "off"
}
}
\ No newline at end of file
diff --git a/components/Header.tsx b/components/Header.tsx
@@ -79,7 +79,7 @@ export default class Header extends PureComponent<Props, State> {
<div className='flex'>
{
this.state.directory_data.some(thing => thing.user_id == this.context.client.userId) ?
- <a className='inline-flex justify-center items-center text-teal-400 hover:text-teal-200 bg-transparent relative h-14 min-w-[9.25rem] z-[2] cursor-pointer font-bold'>Submit</a> :
+ <Link href="/submit"><a className='inline-flex justify-center items-center text-teal-400 hover:text-teal-200 bg-transparent relative h-14 min-w-[9.25rem] z-[2] cursor-pointer font-bold'>Submit</a></Link> :
<a className='inline-flex justify-center items-center text-teal-400 hover:text-teal-200 bg-transparent relative h-14 min-w-[9.25rem] z-[2] cursor-pointer font-bold'>Setup Account</a>
}
</div>
diff --git a/pages/login.tsx b/pages/login.tsx
@@ -74,22 +74,22 @@ class Login extends PureComponent<Props, State> {
{ error: error.message }
);
}
- let token = undefined;
try {
- token = await this.context.client.getOpenidToken();
+ const token = await this.context.client.getOpenidToken();
+ const resp = await fetch("/api/directory", { method: "POST", body: JSON.stringify({ access_token: token, user_id: this.context.client.userId, user_room: `#${this.context.client.userId}` }) });
+ const body = await resp.json();
+ if (body.error_code) {
+ if (body.error_code !== "001") {
+ console.log(body.error);
+ }
+ }
} catch (error: any) {
this.setState(
{ error: `Failed to reach your server to verify your user: ${error.message}` }
);
return;
}
- const resp = await fetch("/api/directory", { method: "POST", body: JSON.stringify({ access_token: token, user_id: this.context.client.userId, user_room: `#${this.context.client.userId}` }) });
- const body = await resp.json();
- if (body.error_code) {
- if (body.error_code !== "001") {
- console.log(body.error);
- }
- }
+
}
await this.props.router.replace("/");
if (typeof window !== "undefined") {