mirror of
https://github.com/nikdoof/pocket-id.git
synced 2025-12-24 23:09:22 +00:00
feat: allow sign in with email (#100)
This commit is contained in:
@@ -11,13 +11,7 @@ export default class AppConfigService extends APIService {
|
||||
}
|
||||
|
||||
const { data } = await this.api.get<AppConfigRawResponse>(url);
|
||||
|
||||
const appConfig: Partial<AllAppConfig> = {};
|
||||
data.forEach(({ key, value }) => {
|
||||
(appConfig as any)[key] = this.parseValue(value);
|
||||
});
|
||||
|
||||
return appConfig as AllAppConfig;
|
||||
return this.parseConfigList(data);
|
||||
}
|
||||
|
||||
async update(appConfig: AllAppConfig) {
|
||||
@@ -27,7 +21,7 @@ export default class AppConfigService extends APIService {
|
||||
(appConfigConvertedToString as any)[key] = (appConfig as any)[key].toString();
|
||||
}
|
||||
const res = await this.api.put('/application-configuration', appConfigConvertedToString);
|
||||
return res.data as AllAppConfig;
|
||||
return this.parseConfigList(res.data);
|
||||
}
|
||||
|
||||
async updateFavicon(favicon: File) {
|
||||
@@ -76,6 +70,15 @@ export default class AppConfigService extends APIService {
|
||||
};
|
||||
}
|
||||
|
||||
private parseConfigList(data: AppConfigRawResponse) {
|
||||
const appConfig: Partial<AllAppConfig> = {};
|
||||
data.forEach(({ key, value }) => {
|
||||
(appConfig as any)[key] = this.parseValue(value);
|
||||
});
|
||||
|
||||
return appConfig as AllAppConfig;
|
||||
}
|
||||
|
||||
private parseValue(value: string) {
|
||||
if (value === 'true') {
|
||||
return true;
|
||||
|
||||
@@ -51,4 +51,8 @@ export default class UserService extends APIService {
|
||||
const res = await this.api.post(`/one-time-access-token/${token}`);
|
||||
return res.data as User;
|
||||
}
|
||||
|
||||
async requestOneTimeAccessEmail(email: string, redirectPath?: string) {
|
||||
await this.api.post('/one-time-access-email', { email, redirectPath });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user