Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Géocontrib Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
externe Matthieu
Géocontrib Frontend
Commits
4d676c64
Commit
4d676c64
authored
3 years ago
by
leandro
Browse files
Options
Downloads
Patches
Plain Diff
fix list fond carto
parent
e44ad0cd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/store/modules/map.js
+41
-25
41 additions, 25 deletions
src/store/modules/map.js
src/views/project/Project_mapping.vue
+5
-1
5 additions, 1 deletion
src/views/project/Project_mapping.vue
with
46 additions
and
26 deletions
src/store/modules/map.js
+
41
−
25
View file @
4d676c64
...
@@ -153,43 +153,59 @@ const map = {
...
@@ -153,43 +153,59 @@ const map = {
SAVE_BASEMAPS
({
state
,
rootState
,
dispatch
},
newBasemapIds
)
{
SAVE_BASEMAPS
({
state
,
rootState
,
dispatch
},
newBasemapIds
)
{
for
(
let
basemap
of
state
.
basemaps
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
basemap
[
"
project
"
]
=
rootState
.
project_slug
for
(
let
basemap
of
state
.
basemaps
)
{
// TODO: différencier PUT & POST
basemap
[
"
project
"
]
=
rootState
.
project_slug
console
.
log
(
newBasemapIds
.
includes
(
basemap
.
id
),
newBasemapIds
,
basemap
.
id
);
// TODO: différencier PUT & POST
if
(
newBasemapIds
.
includes
(
basemap
.
id
))
{
if
(
newBasemapIds
.
includes
(
basemap
.
id
))
{
axios
axios
.
post
(
`
${
this
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
base-maps/`
,
basemap
)
.
post
(
`
${
this
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
base-maps/`
,
basemap
)
.
then
((
response
)
=>
(
console
.
log
(
response
.
data
)))
.
then
((
response
)
=>
{
.
catch
((
error
)
=>
{
resolve
(
response
);
throw
error
;
})
});
.
catch
((
error
)
=>
{
}
else
{
reject
(
error
);
axios
throw
error
;
.
put
(
`
${
this
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
base-maps/
${
basemap
.
id
}
/`
,
basemap
)
});
.
then
((
response
)
=>
(
console
.
log
(
response
.
data
)))
}
else
{
.
catch
((
error
)
=>
{
axios
throw
error
;
.
put
(
`
${
this
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
base-maps/
${
basemap
.
id
}
/`
,
basemap
)
});
.
then
((
response
)
=>
{
resolve
(
response
);
})
.
catch
((
error
)
=>
{
reject
(
error
);
throw
error
;
});
}
}
}
}
//* delete in the backend the basemaps that was rewoved from the front
//* delete in the backend the basemaps that was rewoved from the front
for
(
let
basemapId
of
state
.
basemapsToDelete
)
{
for
(
let
basemapId
of
state
.
basemapsToDelete
)
{
dispatch
(
"
DELETE_BASEMAP
"
,
basemapId
)
dispatch
(
"
DELETE_BASEMAP
"
,
basemapId
);
.
then
((
response
)
=>
{
}
resolve
(
response
);
});
}
state
.
basemapsToDelete
=
[]
});
},
},
DELETE_BASEMAP
({
commit
},
basemapId
)
{
DELETE_BASEMAP
({
commit
},
basemapId
)
{
axios
return
new
Promise
((
resolve
,
reject
)
=>
{
.
delete
(
`
${
this
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
base-maps/`
,
basemapId
)
let
url
=
`
${
this
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
base-maps/`
+
basemapId
axios
.
delete
(
url
)
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
if
(
response
&&
response
.
status
===
200
)
{
commit
(
"
REMOVE_BASEMAP_ID_TO_DELETE
"
,
basemapId
)
commit
(
"
REMOVE_BASEMAP_ID_TO_DELETE
"
,
basemapId
)
}
}
resolve
(
response
);
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
reject
(
error
);
throw
error
;
throw
error
;
});
});
});
}
}
},
},
}
}
...
...
This diff is collapsed.
Click to expand it.
src/views/project/Project_mapping.vue
+
5
−
1
View file @
4d676c64
...
@@ -70,7 +70,11 @@ export default {
...
@@ -70,7 +70,11 @@ export default {
saveChanges
()
{
saveChanges
()
{
// ToDo : check if values are filled
// ToDo : check if values are filled
this
.
$store
.
dispatch
(
"
map/SAVE_BASEMAPS
"
,
this
.
newBasemapIds
);
this
.
$store
.
dispatch
(
"
map/SAVE_BASEMAPS
"
,
this
.
newBasemapIds
)
.
then
((
res
)
=>
{
console
.
log
(
'
res
'
,
res
)
});
this
.
newBasemapIds
=
[];
},
},
},
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment