From 0283cba7920e51368adf7b80e1aac652bc70fda7 Mon Sep 17 00:00:00 2001 From: Bruce Berrios <58147810+Bruception@users.noreply.github.com> Date: Mon, 26 Sep 2022 04:51:52 -0400 Subject: [PATCH] Replace profile URI to use username (#3598) Bruception * Replace Profile URL to use username * Remove Auth import * using replace state to fix back button not working Co-authored-by: Miodec --- backend/src/constants/base-configuration.ts | 2 +- frontend/src/ts/pages/account.ts | 4 ++-- frontend/src/ts/pages/profile.ts | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/constants/base-configuration.ts b/backend/src/constants/base-configuration.ts index bf660a05e..8936e1d23 100644 --- a/backend/src/constants/base-configuration.ts +++ b/backend/src/constants/base-configuration.ts @@ -216,7 +216,7 @@ export const CONFIGURATION_FORM_SCHEMA: ObjectSchema = { fields: { signUp: { type: "boolean", - label: "Enabled", + label: "Sign Up Enabled", }, xp: { type: "object", diff --git a/frontend/src/ts/pages/account.ts b/frontend/src/ts/pages/account.ts index cc16e49cf..aa26d3dae 100644 --- a/frontend/src/ts/pages/account.ts +++ b/frontend/src/ts/pages/account.ts @@ -16,7 +16,6 @@ import * as Profile from "../elements/profile"; import format from "date-fns/format"; import type { ScaleChartOptions } from "chart.js"; -import { Auth } from "../firebase"; let filterDebug = false; //toggle filterdebug @@ -1110,7 +1109,8 @@ $(".pageAccount .content .group.aboveHistory .exportCSV").on("click", () => { }); $(document).on("click", ".pageAccount .profile .details .copyLink", () => { - const url = `${location.origin}/profile/${Auth.currentUser?.uid}?isUid`; + const { name } = DB.getSnapshot(); + const url = `${location.origin}/profile/${name}`; navigator.clipboard.writeText(url).then( function () { diff --git a/frontend/src/ts/pages/profile.ts b/frontend/src/ts/pages/profile.ts index 34be27be0..8ce74c103 100644 --- a/frontend/src/ts/pages/profile.ts +++ b/frontend/src/ts/pages/profile.ts @@ -161,6 +161,8 @@ async function update(options: UpdateOptions): Promise { ); } + window.history.replaceState(null, "", `/profile/${response.data.name}`); + Profile.update("profile", response.data); PbTables.update(response.data.personalBests, true); } else {