refactor(data): replace schema classes with readonly models
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { fromPromise } from "xstate";
|
||||
|
||||
import type { UserView } from "@/stores/user/user-view";
|
||||
import { getUserRepository } from "@/data/repositories/user_repository";
|
||||
import type { UserEntitlementSnapshotData } from "@/data/schemas/user";
|
||||
import { UserStorage } from "@/data/storage/user/user_storage";
|
||||
import type { UserView } from "@/stores/user/user-view";
|
||||
import { Result } from "@/utils/result";
|
||||
|
||||
import {
|
||||
@@ -36,9 +36,9 @@ export const userFetchActor = fromPromise<UserFetchData>(async () => {
|
||||
if (Result.isErr(userResult)) return { user: null, snapshot };
|
||||
|
||||
const view = applyEntitlementSnapshotToView(
|
||||
toView(userResult.data.toJson()),
|
||||
toView(userResult.data),
|
||||
snapshot,
|
||||
);
|
||||
await userStorage.setUser(userResult.data.toJson());
|
||||
await userStorage.setUser(userResult.data);
|
||||
return { user: view, snapshot };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user