@@ -19,27 +30,32 @@
{{ $t('gymPage.homePage.recentLifts') }}
-
+
diff --git a/gymboard-app/src/router/gym-routing.ts b/gymboard-app/src/router/gym-routing.ts
index cad3c97..0f36475 100644
--- a/gymboard-app/src/router/gym-routing.ts
+++ b/gymboard-app/src/router/gym-routing.ts
@@ -38,4 +38,4 @@ export async function getGymFromRoute(): Promise
{
*/
export function getGymCompoundId(gym: GymRoutable): string {
return `${gym.countryCode}_${gym.cityShortName}_${gym.shortName}`;
-}
\ No newline at end of file
+}
diff --git a/gymboard-app/src/router/routes.ts b/gymboard-app/src/router/routes.ts
index d413134..79b20be 100644
--- a/gymboard-app/src/router/routes.ts
+++ b/gymboard-app/src/router/routes.ts
@@ -6,6 +6,7 @@ import GymPage from 'pages/gym/GymPage.vue';
import GymSubmissionPage from 'pages/gym/GymSubmissionPage.vue';
import GymHomePage from 'pages/gym/GymHomePage.vue';
import GymLeaderboardsPage from 'pages/gym/GymLeaderboardsPage.vue';
+import TestingPage from 'pages/TestingPage.vue';
const routes: RouteRecordRaw[] = [
{
@@ -13,6 +14,7 @@ const routes: RouteRecordRaw[] = [
component: MainLayout,
children: [
{ path: '', component: IndexPage },
+ { path: 'testing', component: TestingPage },
{
path: 'gyms/:countryCode/:cityShortName/:gymShortName',
component: GymPage,
diff --git a/gymboard-app/src/stores/auth-store.ts b/gymboard-app/src/stores/auth-store.ts
new file mode 100644
index 0000000..3337b8e
--- /dev/null
+++ b/gymboard-app/src/stores/auth-store.ts
@@ -0,0 +1,34 @@
+/**
+ * This store keeps track of the authentication state of the web app, which
+ * is just keeping the current user and their token.
+ *
+ * See src/api/main/auth.ts for mutators of this store.
+ */
+
+import { defineStore } from 'pinia';
+import { User } from 'src/api/main/auth';
+
+interface AuthState {
+ user: User | null;
+ token: string | null;
+}
+
+export const useAuthStore = defineStore('authStore', {
+ state: (): AuthState => {
+ return { user: null, token: null };
+ },
+ getters: {
+ loggedIn: (state) => state.user !== null && state.token !== null,
+ axiosConfig(state) {
+ if (this.token !== null) {
+ return {
+ headers: { Authorization: 'Bearer ' + state.token },
+ };
+ } else {
+ return {};
+ }
+ },
+ },
+});
+
+export type AuthStoreType = ReturnType;