mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-07 16:05:12 +08:00
updated messages
This commit is contained in:
parent
02b2ae0cde
commit
f607b6d94c
2 changed files with 19 additions and 20 deletions
|
|
@ -55,7 +55,7 @@ let canCall = true;
|
|||
|
||||
export function sendVerificationEmail(): void {
|
||||
if (Auth === undefined) {
|
||||
Notifications.add("Offline mode", -1, 3);
|
||||
Notifications.add("Authentication uninitialized", -1, 3);
|
||||
return;
|
||||
}
|
||||
Loader.show();
|
||||
|
|
@ -353,7 +353,7 @@ if (Auth) {
|
|||
|
||||
export function signIn(): void {
|
||||
if (Auth === undefined) {
|
||||
Notifications.add("Offline mode", -1, 3);
|
||||
Notifications.add("Authentication uninitialized", -1, 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -397,7 +397,7 @@ export function signIn(): void {
|
|||
|
||||
export async function forgotPassword(email: any): Promise<void> {
|
||||
if (Auth === undefined) {
|
||||
Notifications.add("Offline mode", -1, 3);
|
||||
Notifications.add("Authentication uninitialized", -1, 3);
|
||||
return;
|
||||
}
|
||||
if (!canCall) {
|
||||
|
|
@ -426,7 +426,7 @@ export async function forgotPassword(email: any): Promise<void> {
|
|||
|
||||
export async function signInWithGoogle(): Promise<void> {
|
||||
if (Auth === undefined) {
|
||||
Notifications.add("Offline mode", -1, 3);
|
||||
Notifications.add("Authentication uninitialized", -1, 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -471,7 +471,7 @@ export async function signInWithGoogle(): Promise<void> {
|
|||
|
||||
export async function addGoogleAuth(): Promise<void> {
|
||||
if (Auth === undefined) {
|
||||
Notifications.add("Offline mode", -1, 3);
|
||||
Notifications.add("Authentication uninitialized", -1, 3);
|
||||
return;
|
||||
}
|
||||
Loader.show();
|
||||
|
|
@ -496,7 +496,7 @@ export async function addPasswordAuth(
|
|||
password: string
|
||||
): Promise<void> {
|
||||
if (Auth === undefined) {
|
||||
Notifications.add("Offline mode", -1, 3);
|
||||
Notifications.add("Authentication uninitialized", -1, 3);
|
||||
return;
|
||||
}
|
||||
Loader.show();
|
||||
|
|
@ -532,7 +532,7 @@ export async function addPasswordAuth(
|
|||
|
||||
export function signOut(): void {
|
||||
if (Auth === undefined) {
|
||||
Notifications.add("Offline mode", -1, 3);
|
||||
Notifications.add("Authentication uninitialized", -1, 3);
|
||||
return;
|
||||
}
|
||||
if (!Auth.currentUser) return;
|
||||
|
|
@ -558,7 +558,7 @@ export function signOut(): void {
|
|||
|
||||
async function signUp(): Promise<void> {
|
||||
if (Auth === undefined) {
|
||||
Notifications.add("Offline mode", -1, 3);
|
||||
Notifications.add("Authentication uninitialized", -1, 3);
|
||||
return;
|
||||
}
|
||||
RegisterCaptchaPopup.show();
|
||||
|
|
@ -733,7 +733,7 @@ $(".pageLogin .login .button.signInWithGoogle").on("click", () => {
|
|||
|
||||
$("#top .signInOut").on("click", () => {
|
||||
if (Auth === undefined) {
|
||||
Notifications.add("Offline mode", -1, 3);
|
||||
Notifications.add("Authentication uninitialized", -1, 3);
|
||||
return;
|
||||
}
|
||||
if (Auth.currentUser) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { FirebaseApp, initializeApp } from "firebase/app";
|
|||
import { getAuth, Auth as AuthType } from "firebase/auth";
|
||||
import { firebaseConfig } from "./constants/firebase-config"; // eslint-disable-line require-path-exists/exists
|
||||
import * as Notifications from "./elements/notifications";
|
||||
import { createErrorMessage } from "./utils/misc";
|
||||
|
||||
// Initialize Firebase
|
||||
export let app: FirebaseApp | undefined;
|
||||
|
|
@ -15,15 +16,13 @@ try {
|
|||
app = undefined;
|
||||
Auth = undefined;
|
||||
console.error("Authentication failed to initialize", e);
|
||||
const error = e as Error;
|
||||
Notifications.addBanner(
|
||||
"Authentication failed to initialize" +
|
||||
(window.location.hostname === "localhost" ? ": " + error.message : ""),
|
||||
0,
|
||||
undefined,
|
||||
false
|
||||
);
|
||||
// $("body").text(
|
||||
// "Failed to initialize Firebase. Are you sure you have the correct config in the firebase-config.ts file?"
|
||||
// );
|
||||
if (window.location.hostname === "localhost") {
|
||||
Notifications.addBanner(
|
||||
createErrorMessage(e, "Authentication uninitialized") +
|
||||
" Check your firebase-config.ts",
|
||||
0,
|
||||
undefined,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue