mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-14 16:46:22 +08:00
@@ -2,6 +2,7 @@ export * from './blobs';
|
||||
export * from './invite';
|
||||
export * from './notification';
|
||||
export * from './permission';
|
||||
export * from './settings';
|
||||
export * from './testing-app';
|
||||
export * from './testing-module';
|
||||
export * from './user';
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { SettingsType, UpdateSettingsInput } from '../../core/user/types';
|
||||
import type { TestingApp } from './testing-app';
|
||||
|
||||
export async function getSettings(app: TestingApp): Promise<SettingsType> {
|
||||
const res = await app.gql(
|
||||
`
|
||||
query settings {
|
||||
currentUser {
|
||||
settings {
|
||||
receiveInvitationEmail
|
||||
receiveMentionEmail
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
);
|
||||
return res.currentUser.settings;
|
||||
}
|
||||
|
||||
export async function updateSettings(
|
||||
app: TestingApp,
|
||||
input: UpdateSettingsInput
|
||||
): Promise<boolean> {
|
||||
const res = await app.gql(
|
||||
`
|
||||
mutation updateSettings($input: UpdateSettingsInput!) {
|
||||
updateSettings(input: $input)
|
||||
}
|
||||
`,
|
||||
{ input }
|
||||
);
|
||||
return res.updateSettings;
|
||||
}
|
||||
Reference in New Issue
Block a user