* [up] add config for custom images, better js * [up] use bundler to bundle js * [fix] remove domcontentloaded since defer is used * [fix] formatting with black * [fix] images drf api * [up] add support for custom icons on additional roles: power panel, power feed, circuit * [up] optimize topology generation by using `_id` when trying to access pk of related object * [fix] kebab case instead of slugification * [fix] use empty queryset in api views & change coord save logic
18 lines
505 B
JavaScript
18 lines
505 B
JavaScript
export const getCookie = (name) => {
|
|
if (!document.cookie) return
|
|
|
|
let cookieValue = null
|
|
const cookies = document.cookie.split(';')
|
|
|
|
for (let i = 0; i < cookies.length; i++) {
|
|
const cookie = cookies[i].trim()
|
|
// Does this cookie string begin with the name we want?
|
|
if (cookie.substring(0, name.length + 1) === name + '=') {
|
|
cookieValue = decodeURIComponent(cookie.substring(name.length + 1))
|
|
break
|
|
}
|
|
}
|
|
|
|
return cookieValue
|
|
}
|