[org] fix: Fix 'update pattern' link
This commit is contained in:
parent
b5d5c4f15d
commit
c5720c1163
2 changed files with 4 additions and 1 deletions
|
@ -6,6 +6,7 @@ import {
|
||||||
shortDate,
|
shortDate,
|
||||||
horFlexClasses,
|
horFlexClasses,
|
||||||
newPatternUrl,
|
newPatternUrl,
|
||||||
|
patternUrlFromState,
|
||||||
} from '@freesewing/utils'
|
} from '@freesewing/utils'
|
||||||
import { urls, control as controlConfig } from '@freesewing/config'
|
import { urls, control as controlConfig } from '@freesewing/config'
|
||||||
|
|
||||||
|
@ -379,7 +380,7 @@ const PatternHeader = ({
|
||||||
{pattern.userId === account.id && (
|
{pattern.userId === account.id && (
|
||||||
<>
|
<>
|
||||||
<Link
|
<Link
|
||||||
href={`/account/patterns/${pattern.design}/edit?id=${pattern.id}`}
|
href={patternUrlFromState(pattern, true)}
|
||||||
className={`tw-daisy-btn tw-daisy-btn-primary tw-daisy-btn-outline ${horFlexClasses}`}
|
className={`tw-daisy-btn tw-daisy-btn-primary tw-daisy-btn-outline ${horFlexClasses}`}
|
||||||
>
|
>
|
||||||
<FreeSewingIcon /> Update Pattern
|
<FreeSewingIcon /> Update Pattern
|
||||||
|
|
|
@ -437,6 +437,8 @@ export const patternUrlFromState = (state = {}, includeMeasurements = false, vie
|
||||||
settings,
|
settings,
|
||||||
view,
|
view,
|
||||||
}
|
}
|
||||||
|
// When restoring a stored pattern, it will have an ID that we should re-use for saving.
|
||||||
|
if (state.id) obj.pid = state.id
|
||||||
|
|
||||||
return `/editor/#s=${encodeURIComponent(JSON.stringify(obj))}`
|
return `/editor/#s=${encodeURIComponent(JSON.stringify(obj))}`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue