Refactor frontend components and enhance API integration
- Updated frontend-nuxt.mdc to specify usage of composables for API calls. - Added new AuthCard and ConfirmModal components for improved UI consistency. - Introduced UserAvatar component for user profile display, replacing previous Gravatar implementation. - Implemented useFormSubmit composable for handling form submissions with loading and error states. - Enhanced vitest.config.ts to include coverage reporting for composables and components. - Removed deprecated useAdminApi and useAuth composables to streamline API interactions. - Updated login and setup pages to utilize new components and composables for better user experience.
This commit is contained in:
@@ -30,6 +30,7 @@ type ExportService struct {
|
||||
}
|
||||
|
||||
// NewExportService creates an ExportService with the given store and map service.
|
||||
// Uses direct args (two dependencies) rather than a deps struct.
|
||||
func NewExportService(st *store.Store, mapSvc *MapService) *ExportService {
|
||||
return &ExportService{st: st, mapSvc: mapSvc}
|
||||
}
|
||||
@@ -190,7 +191,9 @@ func (s *ExportService) Merge(ctx context.Context, zr *zip.Reader) error {
|
||||
gridRaw := grids.Get([]byte(gid))
|
||||
if gridRaw != nil {
|
||||
gd := app.GridData{}
|
||||
json.Unmarshal(gridRaw, &gd)
|
||||
if err := json.Unmarshal(gridRaw, &gd); err != nil {
|
||||
return err
|
||||
}
|
||||
ops = append(ops, TileOp{
|
||||
MapID: gd.Map,
|
||||
X: gd.Coord.X,
|
||||
@@ -265,7 +268,9 @@ func (s *ExportService) processMergeJSON(
|
||||
gridRaw := grids.Get([]byte(v))
|
||||
if gridRaw != nil {
|
||||
gd := app.GridData{}
|
||||
json.Unmarshal(gridRaw, &gd)
|
||||
if err := json.Unmarshal(gridRaw, &gd); err != nil {
|
||||
return err
|
||||
}
|
||||
existingMaps[gd.Map] = struct{ X, Y int }{gd.Coord.X - c.X, gd.Coord.Y - c.Y}
|
||||
}
|
||||
}
|
||||
@@ -301,7 +306,9 @@ func (s *ExportService) processMergeJSON(
|
||||
mi := app.MapInfo{}
|
||||
mraw := mapB.Get([]byte(strconv.Itoa(id)))
|
||||
if mraw != nil {
|
||||
json.Unmarshal(mraw, &mi)
|
||||
if err := json.Unmarshal(mraw, &mi); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if mi.Priority {
|
||||
mapid = id
|
||||
@@ -333,7 +340,9 @@ func (s *ExportService) processMergeJSON(
|
||||
if len(existingMaps) > 1 {
|
||||
grids.ForEach(func(k, v []byte) error {
|
||||
gd := app.GridData{}
|
||||
json.Unmarshal(v, &gd)
|
||||
if err := json.Unmarshal(v, &gd); err != nil {
|
||||
return err
|
||||
}
|
||||
if gd.Map == mapid {
|
||||
return nil
|
||||
}
|
||||
@@ -349,7 +358,9 @@ func (s *ExportService) processMergeJSON(
|
||||
}
|
||||
tileraw := zoom.Get([]byte(gd.Coord.Name()))
|
||||
if tileraw != nil {
|
||||
json.Unmarshal(tileraw, &td)
|
||||
if err := json.Unmarshal(tileraw, &td); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
gd.Map = mapid
|
||||
|
||||
Reference in New Issue
Block a user