mirror of
https://github.com/modrinth/code.git
synced 2026-08-28 02:24:56 +00:00
feat: blocking frontend (#6911)
* feat: blocking api interfaces * feat: block action on user pages + shared instance flows * feat: safety settings subpage * feat: interaction source settings * feat: finish social settings * feat: profile settings xplat * fix: prepr * feat: click on friends * default instance -> game options & fix feature flag width * fix: scroll indicators --------- Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import type { InjectionKey } from 'vue'
|
||||
|
||||
export type UnsavedChangesController = {
|
||||
hasChanges: () => boolean
|
||||
getOriginal: () => Record<string, unknown>
|
||||
getModified: () => Record<string, unknown>
|
||||
isSaving: () => boolean
|
||||
reset: () => void
|
||||
save: () => void | Promise<void>
|
||||
}
|
||||
|
||||
export type AppSettingsModalContext = {
|
||||
close: () => boolean
|
||||
registerUnsavedChangesController: (controller: UnsavedChangesController | null) => void
|
||||
}
|
||||
|
||||
export const appSettingsModalContextKey: InjectionKey<AppSettingsModalContext> =
|
||||
Symbol('appSettingsModalContext')
|
||||
export const appSettingsModalOpenProfileKey: InjectionKey<() => void> = Symbol(
|
||||
'appSettingsModalOpenProfile',
|
||||
)
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type AuthUser,
|
||||
provideAuth,
|
||||
} from '@modrinth/ui'
|
||||
import { computed, type Ref, ref, watchEffect } from 'vue'
|
||||
import { computed, type Ref, ref, watch, watchEffect } from 'vue'
|
||||
|
||||
type AppCredentials = {
|
||||
session?: string | null
|
||||
@@ -37,5 +37,13 @@ export function setupAuthProvider(
|
||||
user.value = credentials.value?.user ?? null
|
||||
})
|
||||
|
||||
watch(user, (updatedUser) => {
|
||||
if (!credentials.value || !updatedUser || credentials.value.user === updatedUser) return
|
||||
credentials.value = {
|
||||
...credentials.value,
|
||||
user: updatedUser,
|
||||
}
|
||||
})
|
||||
|
||||
provideAuth(authProvider)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user