forked from mirrors/akkoma-fe
10 lines
291 B
JavaScript
10 lines
291 B
JavaScript
|
// Generate url based on template
|
||
|
// Example: /api/v1/accounts/:id/mute -> /api/v1/accounts/123/mute
|
||
|
export const generateUrl = (template, params = {}) => {
|
||
|
let url = template
|
||
|
Object.entries(params).forEach(([key, value]) => {
|
||
|
url = url.replace(':' + key, value)
|
||
|
})
|
||
|
return url
|
||
|
}
|